简体   繁体   中英

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!

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 ]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM