The solution I have been using is to do three queries similar to the below

SELECT * FROM table WHERE field='ID00025'

SELECT * FROM table WHERE field<'ID00025' ORDER BY field DESC LIMIT 0,1

SELECT * FROM table WHERE field>'ID00025' ORDER BY field ASC LIMIT 0,1

If you whish more row returned change the number in the LIMIT
-- 
Raymond Gubala
Program Coordinator
Multimedia Design and Web Developer
Durham College
mailto:[EMAIL PROTECTED]

> From: "Mark Lo" <[EMAIL PROTECTED]>
> Date: Fri, 22 Feb 2002 23:15:18 +0800
> To: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Subject: [PHP] Next and Preview Row
> 
> Dear All,
> 
> I am using PHP + MYSQL.  I have a question that I need some expert
> to help.  That is:
> 
> How do I find out a next and preview row values by using PHP and MYSQL.  For
> examples,
> 
> Row 10    ID00010    need this value
> Row 11    ID00025    have this value on hand
> Row 12    ID00063    need this value
> 
> The questions is how do I find out the values in Row 10 and Row 12, if and
> only if I only have one data that is "ID00025" (select * from table where
> field="ID00025") .  But, the questions is How do I find out the data in Row
> 10 and Row 12 which is "ID00010" and "ID00063" assume I don't know the
> values of "ID00025" is in Row 11.
> 
> Thank you so much for your help.
> 
> 
> Mark Lo
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to