Re: move next

From: Date: Thu, 16 May 2002 14:53:11 +0000
Subject: Re: move next
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-19224@lists.php.net to get a copy of this message
Look at setting up a couple of vars (I use $start_rec and $max_display) and then use these to do a LIMIT on your SELECT statement. Then use a link to go to next item or previous item. Pseudo code: $first_rec = ($first_rec) ? $first_rec : 0; // if rec is passed in, use it else start at 0 $max_display = 1; // show one record at a time // first do a select of all records to get mysql_numrecs and assign to $num_recs // then get the current record $sql = "select * from $table LIMIT $first_rec,$max_display"; ... $next = $first_rec+1; $prev_rec=$first_rec-1; $this_rec = $next; // same record number as current, except 1-based echo "<a href='file.php?first_rec= $prev_rec'>Previous</a> Showing $this_rec of $num_recs<a href='file.php?first_rec=$next'>Next</a>"; HTH On Thursday, May 16, 2002, at 08:32 AM, Natividad Castro wrote:
Hi to all, how do I move through a recordset? For example, if I have 4 records and I want to display one at a time and let the user to click a MoveNext button to go to the next record or a Previous button to go to the Previous record. Thanks in advanced Nato -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Terry Romine
Web Developer JumpInteractive.com

« previous php.db (#19224) next »