Re: last record

From: Date: Tue, 25 Jan 2005 03:32:24 +0000
Subject: Re: last record
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-38312@lists.php.net to get a copy of this message
neil wrote:
Apart from the obvious of reversing the sort order in a select statement and then picking off the first record eg. select * from blah where somefield like '%something%' order by someotherfield desc limit 0,1 is there any way in php rather than sql to pick the last record in a record set?
Unless you're trying to recreate mysql_insert_id(), then the way you have written is the way to do it. I suppose you could use mysql_result(), but that'd be pretty inefficient. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.db (#38312) next »