RE: [PHP-DB] Link for next db record
| From: | Beau Lebens | Date: | Mon, 13 May 2002 05:37:16 +0000 |
| Subject: | RE: [PHP-DB] Link for next db record | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-19148@lists.php.net to get a copy of this message | ||
jen,
assuming you are "currently" looking at a page which is something like
php.php?record=3, then you should be able to just do
<a href='php.php?record=<?php echo ($record-1) ?>'>Previous
record</a><a
href='php.php<?php echo ($record+1) ?>'>Next record</a>
and then on the php.php page, you would obviously being grabbing something
from the database using a unique identifier or similar.
one "gotcha" to be careful of - if there is a chance that your id field will
have a gap in it (ie. not be perfectly consecutive) then you should make
your query something like
SELECT * FROM table LIMIT $record, 1
rather than
SELECT * FROM table WHERE id='$record'
Since that takes them in whatever order, but only SELECTs from $record and
gets 1 record.
HTH
Beau
// -----Original Message-----
// From: Jennifer Downey [mailto:jendowney@attbi.com]
// Sent: Monday, 13 May 2002 1:14 PM
// To: php-db@lists.php.net
// Subject: [PHP-DB] Link for next db record
//
//
// Hi all,
//
// Wondering if you could help or point me to a tut where I
// can use a link to
// get the next record in the db?
//
// Like <a href='php.php'>Previous record</a><a
// href='php.php'>Next record</a>
//
// How do I go about doing this.
//
// Thanks
// Jennifer
//
// --
// The sleeper has awaken
//
//
// ---
// Outgoing mail is certified Virus Free.
// Checked by AVG anti-virus system (http://www.grisoft.com).
// Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
//
//
//
// --
// PHP Database Mailing List (http://www.php.net/)
// To unsubscribe, visit: http://www.php.net/unsub.php
//