Cody Butz
Cody Butz

Reputation: 294

SQL Next/previous Assoc

So, I am writing a PHP script that needs to get the next assoc in the SQL Query, But It seems like I am writing lots of code for something that is probably in MySQL somewhere, I tryed google but no luck.

Basically what I am doing is grabbing for a DB using this Query:

SELECT * FROM challenges WHERE subcat='%s' ORDER BY points, id ASC;

I am able to grab that value but I have a "next" button and Previous button I want to implement. I just do not know how in SQL I can do that instead of writing 15 lines of php to solve this.

Thanks for any help!

Upvotes: 0

Views: 239

Answers (1)

Shrinath
Shrinath

Reputation: 8118

Google for keyword "pagination mysql php". You'd get a lot of tutorials teaching you how to do it...

All you need is limit keyword from mysql

[ I am assuming you are asking about pagination ]

Upvotes: 1

Related Questions