Re: Getting the last record in a mysql table

From: Date: Fri, 18 Jan 2002 06:14:05 +0000
Subject: Re: Getting the last record in a mysql table
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-81035@lists.php.net to get a copy of this message
Are you sure? I thought mysql_num_rows() would give you the ID number of the last row in a table IF AND ONLY IF there hasn't been any row deletions. I expect to have deletions, but I'll try it out anyway. Thanks, Hugh ----- Original Message ----- From: Jason Murray <Jason.Murray@melbourneit.com.au> To: 'hugh danaher' <hdanaher@earthlink.net>; Php-General <php-general@lists.php.net> Sent: Thursday, January 17, 2002 9:40 PM Subject: RE: [PHP] Getting the last record in a mysql table > > I thought this would be easy but it ain't. What I want is > > the id number of the last record in a table. > > If you use mysql_num_rows() and decrement it by one, you'll > have the ID of the row you can use with mysql_result. > > Jason

« previous php.general (#81035) next »