How to paginate query results for Infinite Scroll?

后端 未结 1 1367
醉话见心
醉话见心 2020-12-10 22:56

I have a sample page that uses 2 PHP files and a MySql database, and I\'m trying to use jQuery infinite scroll on it. How can I load the next group of data from database? Fo

相关标签:
1条回答
  • 2020-12-10 23:18

    You need to add LIMIT to your queries. Example from the MySQL manual:

    SELECT * FROM tbl LIMIT 5,10;  # Retrieve rows 6-15
    

    Here, 5 is the starting offset, and 10 is the amount of rows you want to fetch.

    For the client-side you'll need the infinite scroll jQuery plugin.

    0 讨论(0)
提交回复
热议问题