> I need to build a query that needs to find the previous or next record in
a
> database using a form. The records are numbered using a field called
> 'sb_num'. This field is initially set using the form.
> Would something like this work
> Next:
> Select 'field1', 'field2' from table order by sb_num where
$sb_num>=++sb_num
> limit 1
>
> Previous
> Select 'field1', 'field2' from table order by sb_num desc where
> $sb_num<=--$sb_num limit 1
Yes, only not quite...
select ... where sb_num > $sb_num
select ... where sb_num < $sb_num
Note that it's possible to reach the first or last record, and then there is
no "Next" or "Previous". A nice interface would disable the un-usuable
link.
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
--
PHP General 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]