> -----Original Message----- > From: Chad Day [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 19, 2001 9:15 AM > To: '[EMAIL PROTECTED]' > Subject: [PHP-DB] Getting last row, moving backwards.. > > > I need some help selecting the last row in my database, and then > moving backwards.. I can't just get mysql_num_rows and go back by > 1, as some of the records are missing.. the ID field might have #'s > like 1950, 1948, 1947, 1944, etc, and I don't want it to break by > mistakingly trying to grab 1949. Can someone provide some help or > a link to where in the manual what I'm doing might be explained? > Been searching, no luck yet. Thanks! Wouldn't it be easier to just get them from the database in the order that you want? In your example, something like select * from mytable order by id_field desc would likely do the trick (sorting your results by the value of the ID field, in descending order). --- Mark Roedel | "A wise man once told me that everything in Systems Programmer | life is either a lesson or a joke. Our task LeTourneau University | is to figure out which is which..." Longview, Texas, USA | -- Chris Savage -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]