SQL call to find highest ID (General)

by Alise, Latvia, Tuesday, August 23, 2011, 17:48 (4651 days ago)

Hey,

I want to know the highest ID of all the posts in my forum. I use the code below, and it works. But I wonder if it is an efficient way of doing it or if there's a better way. Thanks :-)


$result = mysql_query("SELECT id FROM <Change_to your_DB>.mlf2_entries ORDER BY id DESC LIMIT 0,1");
$highestID = mysql_result($result, 0);


Complete thread:

 RSS Feed of thread