Jump to content

Noob Question - Displaying Highest ID in a table


kiksy

Recommended Posts

Hi there,

 

Im guessing im missing something obvious and making this hard for myself.... :D

 

Running : 5.0.81-community

 


$result = 'Select ID FROM comments HAVING MAX(id) > 1';
$row =  mysql_query($result);

echo $row['0'];

 

Table structure is ID as primary, then USERNAME , COMMENT, DATE, VALIDATED

 

 

All im trying to do is select the highest ID and then echo it , Ive searched around and found a few solutions but none seemed to work. All I want is the ID number as a $ .

 

Any help at all appreciated.

 

Thanks in advance.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.