Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Grabing the 5 latest rows
- Lenard Redwood
December 13, 2006, 1:16 pm
rate this thread
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT ititle, inumber FROM nucleus_item";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
echo "Name : <br>" .
"Subject : <br>";
What I'd like to do is to grab the 5 latest rows of the "inumber"
field. This field starts from 1 and currently ends at 2100 but everyday
there are new entries. So I think I should sort the table rows from the
greatest number to the lowest, and take only the 5 latest entries. I
didn't find on php.net how to do that. Any idea?