Forum Moderators: coopster

Message Too Old, No Replies

Previous/Next row from table with link

         

skoff

8:11 pm on Apr 15, 2009 (gmt 0)

10+ Year Member



Hi!

I want to know what kind of query i need to have previous and next link. If i'm at index.php?id=1 and i click on the link next it will go to index.php?id=2. how do I do this? And if the id=1 i dont want to see the previous link! Thanks a lot!

eeek

12:25 am on Apr 16, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Wouldn't you just add 1 to the id? Or if you don't have a continuous set of ids you could so something like this:


select * from tablename where id>1 order by id limit 1

(where the id>1 clause actually uses what number you are currenly on)