firethrottle Posted August 27, 2007 Share Posted August 27, 2007 hey, how do i make a next link in an articles system? i know you can just do $nextid = $_get[id] + 1; or whatever, but what if the next id doesn't exist? (eg article not approved, or has been deleted). so in essence, what i am asking is how do you get the next existing id from a database? thanks in advance Quote Link to comment Share on other sites More sharing options...
AndyB Posted August 27, 2007 Share Posted August 27, 2007 Typically with a query like SELECT id WHERE article_status = 'OK' AND id > '$current_id' ORDER by id ASC LIMIT 1 Quote Link to comment Share on other sites More sharing options...
firethrottle Posted August 27, 2007 Author Share Posted August 27, 2007 oh ok. thanks, i never thought of that. i'll try it, it looks like it will work. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.