Re: ID based on position?

From: Date: Wed, 31 Aug 2005 23:25:41 +0000
Subject: Re: ID based on position?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-221673@lists.php.net to get a copy of this message
You could LIMIT your query to the record number you are looking for, and grab the last element in the array from your result set. But this is a serious hack, and I am really wondering why you need to do what your asking, it seems (without knowing more) that you are tackling the problem in the wrong direction, Jason On 8/31/05, Gustav Wiberg <gustav@varupiraten.se> wrote: > > Hi there! > > Is there any function in PHP that gives an ID from a MySQL-db based on > which > position the record has in the table? > > > Let's say, there's a table like this: > > 1. Record1 ID 33 > 2. Record2 ID 76 > 3. Record3 ID 100 > > > If I know position 2, I want to get ID 76. Is the only way to loop through > the recordset? > > /G > @varupiraten.se <http://varupiraten.se> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#221673) next »