what happens if you do this? $result = mysql_query("SELECT MAX(Thought_Num) as Thought_Num FROM quotes",$db);
I'm thinking that the column name in your original query is being called "MAX(Thought_Num)" and not "Thought_Num". Martin -----Original Message----- From: Melanie Gann [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 06, 2002 10:12 AM To: [EMAIL PROTECTED] Subject: [PHP] MySQL selecting the maximum value from a column Thank you all you listeners out there. I'll try to be respectful of your time and patience, and apoligize in advance for my "greeness" - I am 2 weeks into PHP/MySQL. I am trying to select the higest value from the column Thought_Num below. But it returns nothing. <?PHP $db = mysql_connect("localhost", "root"); mysql_select_db("DynaSite",$db); $result = mysql_query("SELECT MAX(Thought_Num) FROM quotes",$db); $myrow = mysql_fetch_array($result); print "the result is $myrow[Thought_Num]"; ?> If I change my select to something that without the MAX (e.g. Select from quotes where DocID=1), the code works fine. Thanks in advance for your help. Regards, Melanie Second Street Web Design http://www.second-street.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php