Problems with max($value)
Posted: Sun Aug 10, 2003 12:03 pm
I am rather new to PHP--taught myself. But I am having a problem with the max fuction in a query. This is part of the program where it is going to look into a database to find the entry with the highest id number which is an auto-increment, therefore finding the newest entry. But whenever I do this, it never works correctly. I tried echoing the statement to see what the system came up with, but it always ends up with something like "Resource id #3" rather than just "3" which is what I need. What should I do to fix this? I'm sure there is a simple solution, but I have been working on this problem for at least 4 hours. X_X
$query23="select max(tut_id) from $tut where tut_approved='y'";
$id = mysql_query($query23)
or die ("too many users-- try again later ");
echo"$id";
$query="select * from $tut where tut_id='$id'";
$result = mysql_query($query)
or die ("too many users-- try again later ");
Here's the page-- http://www.airwalking.com/!omega/
$query23="select max(tut_id) from $tut where tut_approved='y'";
$id = mysql_query($query23)
or die ("too many users-- try again later ");
echo"$id";
$query="select * from $tut where tut_id='$id'";
$result = mysql_query($query)
or die ("too many users-- try again later ");
Here's the page-- http://www.airwalking.com/!omega/