Page 1 of 1

[SOLVED]Help needed in query

Posted: Thu Jul 15, 2004 8:01 pm
by dakkonz
I have a db table of comics titles with a primary index called comicNum and it is auto-incremented.... How can i get the largest value in db???
I tried this but it does not work... does not return anything....
Can anyone help me??

Code: Select all

<?php
$query = "SELECT MAX(comicNum) FROM archive";
$result = mysql_query($query) or die(MySQL_Error());
$row =  mysql_fetch_array($result);
?>

Posted: Thu Jul 15, 2004 8:06 pm
by JAM

Code: Select all

// change...
$row =  mysql_fetch_array($result); 

//...to...
echo mysql_result($result, 0);
Don't forget to look it up in the manual. Have fun. =)