note 22370 added to function.max
| From: | nil at csoma dot elte dot hu | Date: | Sat, 15 Jun 2002 02:23:57 +0000 |
| Subject: | note 22370 added to function.max | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31880@lists.php.net to get a copy of this message | ||
MySQL maximum:
$res=mysql_query("select max(ID) from table;");
if(mysql_num_rows($res)==1){
$row=mysql_fetch_object($res):
echo("Largest ID in table 'table': ".$row->ID."<BR>\n");
} else echo("No rows in table 'table'.<BR>\n");
mysql_free_result($ret);
I think it is the fastest of the "clear" ways.
--
http://www.php.net/manual/en/function.max.php
http://master.php.net/manage/user-notes.php?action=edit+22370
http://master.php.net/manage/user-notes.php?action=delete+22370
http://master.php.net/manage/user-notes.php?action=reject+22370