|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
PHP and MYsql: Trouble pulling data off the DB
I am trying to send a customer a conformation email. I can pull of all the customers shipping details (name, address etc) but when I try to get their email add to create the email. It only returns the value Resource ID #20. Can any one help??????
|
|
#2
|
||||
|
||||
|
I'm guessing you've got a variable misnamed. When you see something like "Resource ID #20," it usually means you're printing the variable you assign mysql_connect() to. You really need to post the relevant code if you want specific help, though.
__________________
Please don't PM me asking for solutions outside the scope of a thread. Keeping all responses in a thread stands to help others who come along later, which is after all what this forum's all about. |
|
#3
|
|||
|
|||
|
Here's the code I'm using.
function email_order($valid_user)
{ $connection = db_connect(); if (!$connection ) { echo "Failed to connect"; exit; } $query_get_order_detail = " select * from orders where userid = '$valid_user'"; $result = mysql_query($query_get_order_detail, $connection); if (!$result) { echo "There is a problem, your order could not be mailed"; exit; } $result = @mysql_fetch_array($result); if (!is_array($result)) { echo "Not an array"; } else { $query_email = "SELECT email FROM customers WHERE userid = '$valid_user'"; $email = mysql_query($query_email, $connection); echo $email; extract($result); $subject = "Order Conformation"; $mailcontent = "User ID: ".$userid. "\n Order ID: ".$orderid."\n" ."Shipping Address line 1: ".$ship_add1."\n" ."Shipping Address line 2: ".$ship_add2."\n" ."Shipping Address line 3: ".$ship_add3."\n" ."Shipping Post Code: ".$ship_postcode."\n"; $fromaddress = "DVD Shack Order Conformation"; if (mail($email, $subject, $mailcontent, $fromaddress)) { echo "An E-mail has been sent confirming your order"; } else { echo "An email could not be sent"; } } } Hope this helps. |
|
#4
|
|||
|
|||
|
Try the following inside your else statement
PHP Code:
__________________
__________________________________________________ _ Wil Moore III, MCP | Integrations Specialist | Senior Consultant Are You Listed...? | DigitallySmooth Inc. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > PHP and MYsql: Trouble pulling data off the DB |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|