Re: [PHP-DB] move next

2002-05-16 Thread Terry Romine

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 "Previous
Showing $this_rec of $num_recsNext";

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


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] move next

2002-05-16 Thread Natividad Castro

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




RE: [PHP-DB] Move next

2001-11-14 Thread Rick Emery

use count() to determine number of elements in the array.  Then use the
returned result as an index to the last element.

Or, do you want to get to the last row of a result set from a mysql query?
In which case, go with:
$result = mysql_query(...)...
$rows = mysql_num_rows($result);
mysql_data_seek($result,$rows);

-Original Message-
From: Harpreet [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 12:51 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Move next


Do we have a matching command for rs.movelast in PHP to get the data in the
last record of the array

$row=mysql_fetch_array($result);

Regards,
Harpreet Kaur
Software Developer
Crispin Corporations Inc.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Move next

2001-11-14 Thread Harpreet

Do we have a matching command for rs.movelast in PHP to get the data in the
last record of the array

$row=mysql_fetch_array($result);

Regards,
Harpreet Kaur
Software Developer
Crispin Corporations Inc.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]