SunQuest
 
           MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
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  
Old April 16th, 2004, 07:13 AM
Erniefrontier Erniefrontier is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 12 Erniefrontier User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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??????

Reply With Quote
  #2  
Old April 16th, 2004, 07:15 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
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.

Reply With Quote
  #3  
Old April 16th, 2004, 07:18 AM
Erniefrontier Erniefrontier is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 12 Erniefrontier User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #4  
Old May 6th, 2004, 12:48 AM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
Try the following inside your else statement

PHP Code:
 $query_email "SELECT email FROM customers WHERE userid = '$valid_user'";
$result mysql_query($query_email$connection);

$email_info = @mysql_fetch_array($result);

$email email_info['email'];
echo 
$email;

/* this should go after all your other code */
mysql_free_result($result); 
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > PHP and MYsql: Trouble pulling data off the DB


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway