RE: [PHP-DB] Retreive email address from MySQL DB

2003-01-08 Thread Matthew Moldvan
mysql_query returns an array, not simply a string ... my recommendation is
do your error checking near your mysql_query statement (i.e.
if(!mysql_query(whatever) die();) then do an else to loop through the
results.

loop using mysql_fetch_row(RESULT), where result is your "RESOURCE ID",
echoing RESULT[x].

hope this helps.

Matthew Moldvan.
System Administrator,
Trilogy International.

> -Original Message-
> From: Info@Best-IT [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 07, 2003 11:34 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Retreive email address from MySQL DB
> 
> 
> I have a database: web_feedback, and it has 5 columns:
> 
> Firstname varchar(40) not null
> Lastname varchar(40) not null
> Email varchar(40) PRIMARY KEY not null
> ServList varchar(40) not null
> Timestamp not null
> 
> I run a query in a PHP script to retrieve the email address 
> the line of code
> looks like this:
> 
> 
> $query_time = mysql_query("select time from DB where email='$email'");
> 
> 
> This line returns RESOURCE ID #2 in $query_time when I use it 
> to echo it's
> value in an email message:
> 
> 
> $mailcontent = $firstname." ".$lastname." has submitted info 
> as follows:
> \n".
> 
> "First Name: ".$firstname."\n".
> 
> "Last Name: ".$lastname."\n".
> 
> "email: ".$email."\n".
> 
> "Selected Services: ".$servList."\n".
> 
> "Time entered: ".$query_time."\n";
> 
> 
> 
> Anyone able to see off hand if I'm doing anything obviously wrong?
> 
> /T
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Retreive email address from MySQL DB

2003-01-07 Thread John W. Holmes
> I have a database: web_feedback, and it has 5 columns:
> 
> Firstname varchar(40) not null
> Lastname varchar(40) not null
> Email varchar(40) PRIMARY KEY not null
> ServList varchar(40) not null
> Timestamp not null
> 
> I run a query in a PHP script to retrieve the email address the line
of
> code
> looks like this:
> 
> 
> $query_time = mysql_query("select time from DB where email='$email'");
> 
> 
> This line returns RESOURCE ID #2 in $query_time when I use it to echo
it's
> value in an email message:
> 
> 
> $mailcontent = $firstname." ".$lastname." has submitted info as
follows:
> \n".
> 
> "First Name: ".$firstname."\n".
> 
> "Last Name: ".$lastname."\n".
> 
> "email: ".$email."\n".
> 
> "Selected Services: ".$servList."\n".
> 
> "Time entered: ".$query_time."\n";
> 
> 
> 
> Anyone able to see off hand if I'm doing anything obviously wrong?

Well, the first thing is that you're selecting 'time' from your table
when the column is named 'timestamp'...

Second, you need to use a mysql_fetch_row/array/object/assoc function to
retrieve the row from the "result set" returned by mysql_query. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php