How to move record in PHP?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
cnnabc
Forum Newbie
Posts: 3
Joined: Fri Feb 29, 2008 3:02 am

How to move record in PHP?

Post 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.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: How to move record in PHP?

Post 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.
(#10850)
cnnabc
Forum Newbie
Posts: 3
Joined: Fri Feb 29, 2008 3:02 am

Re: How to move record in PHP?

Post by cnnabc »

thx yr info.
then how can I move back to previous record?
Any ideas?
Thanks your help.
ilgriso
Forum Newbie
Posts: 1
Joined: Mon Mar 03, 2008 8:13 pm

Re: How to move record in PHP?

Post 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.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: How to move record in PHP?

Post 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.
(#10850)
Post Reply