select ID, Title from Books where ID='500';

That will give you the current set of data to display.  Getting the previous
and next record will depend on your sort order.  Assuming ID as the sort
order, store the value of ID and query for the next record:

select ID from Books where ID > '$ID' order by ID ASC limit 1;

Previous record:

select ID from Books where ID < '$ID' order by ID DESC limit 1;

The same approach works for the Title field.


> -----Original Message-----
> From: blue [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 13, 2002 1:05 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: next and previous buttons performing on a query
> 
> 
> www.phpbuilder.com has an excellent article on creating a 
> results page that
> incorporates NEXT and PREVIOUS links/buttons so that one can navigate
> through the results.. i'll try to find an exact link.
> 
> 
> 
> "Wilbert Enserink" <[EMAIL PROTECTED]> wrote in message
> 007001c212e1$f0f14340$0c01a8c0@pulsar">news:007001c212e1$f0f14340$0c01a8c0@pulsar...
> Hi all,
> 
> 
> I have this mySQL query giving me my result back.
> 
> The info about the current db-record is showing.
> Now I want to display ' view next ' and ' view previous ' 
> buttons on my
> website. which takes you to the same page but with the next 
> record in the
> query result.
> Is there a clever way to do this?
> 
> Any tips are welcome!
> 
> Many regards
> 
> Wilbert Enserink
> 
> -------------------------
> Pas de Deux
> Van Mierisstraat 25
> 2526 NM Den Haag
> tel 070 4450855
> fax 070 4450852
> http://www.pdd.nl
> [EMAIL PROTECTED]
> -------------------------
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
 
****************************************************************************
This message is intended for the sole use of the individual and entity to
whom it is addressed, and may contain information that is privileged,
confidential and exempt from disclosure under applicable law.  If you are
not the intended addressee, nor authorized to receive for the intended
addressee, you are hereby notified that you may not use, copy, disclose or
distribute to anyone the message or any information contained in the
message.  If you have received this message in error, please immediately
advise the sender by reply email and delete the message.  Thank you very
much.                                                                       

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

Reply via email to