WordPress.org

Ready to get started?Download WordPress

Forums

Pagination from custom sql table (2 posts)

  1. alexts
    Member
    Posted 2 years ago #

    Hi,

    I am writing a plugin to display data from that mysql table.
    Table contains around 2mil records.
    I would like to paginate results.
    I searched the forum but unable to find the solution.
    Any help would be appreciated.

  2. bcworkz
    Member
    Posted 2 years ago #

    There's many ways to paginate. One way would be to query only for the records that would be on a particular page by appending a LIMIT constraint to your basic query. So if you want 50 results per page, then for a page 3 request, add LIMIT 100, 50 to your query to get only the page 3 results: records 100-149.

    Obviously, you first will need to use a COUNT query to determine the page range to display to the user.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.