I am developing a web application where there are a number of very similar pages I'd like users to browse through. The data for these "pages" is stored in a database with a unique ID as the primary key.
I'd like to have a "NEXT" button on each page that queries the database and finds out what the next highest ID is, and displays the data from that id. My problem is that there are a couple conditions:
Does anyone have any tips or suggestions? Thanks!
something like this?
SELECT id FROM table WHERE id > '$id' AND active = '1' ORDER BY id ASC LIMIT 1
a PREV button would then need something like this:
SELECT id FROM table WHERE id < '$id' AND active = '1' ORDER BY id DESC LIMIT 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With