Page 1 of 1

How to move record in PHP?

Posted: Fri Feb 29, 2008 3:04 am
by cnnabc
I want to move record next and previous record in PHP?
Does any function to make it?
In ASP, it use "movenext" ? any idea? Thanks your help.

Re: How to move record in PHP?

Posted: Fri Feb 29, 2008 10:06 am
by Christopher
With most of the PHP database libraries, fetching a record will move to the next record. Each fetch will retrieve the next record until you go past the last record in the result set.

Re: How to move record in PHP?

Posted: Sun Mar 02, 2008 2:55 am
by cnnabc
thx yr info.
then how can I move back to previous record?
Any ideas?
Thanks your help.

Re: How to move record in PHP?

Posted: Mon Mar 03, 2008 8:15 pm
by ilgriso
cnnabc wrote:thx yr info.
then how can I move back to previous record?
Any ideas?
Thanks your help.
... Mee too I'm interested in this argument... Thanks.

Re: How to move record in PHP?

Posted: Mon Mar 03, 2008 8:25 pm
by Christopher
Again, the database libraries typically provide a function for this, such as pg_result_seek or mysql_data_seek(). The PHP Manual is a great source of answers to questions like this.

Also, with PHP web applications you don't usually "seek" but instead just read the records in and do whatever is needed. Seeking is much more common in long running applications where the file or database connection is kept open. A PHP request, on the other hand, only runs for a few seconds at most.