WordPress.org

Ready to get started?Download WordPress

Forums

Foreach Loop and Pagination (3 posts)

  1. thesnowjunkies
    Member
    Posted 2 years ago #

    Can't get pagination to work with my custom database query because I don't fully understand custom database queries. All I know is that the code works well. I just can't figure out paging.

    Here's a sample page:
    US Music Festival Guide

    Here's the code:
    http://pastebin.com/miE12Q0D

  2. zimmi88
    Member
    Posted 2 years ago #

    Hmmm.... it looks like your query has a LIMIT 20 included... is that working ok? (Dunno if you're running the code you provided on production or not.)

    You could expand the LIMIT parameter to include a starting point. See here for more details. If that's working, then you'd probably want to use a get parameter (?page=x) for paging. Take the get parameter, multiply by number of items per page, and you have the starting record for your LIMIT query.

    I hope this helps!

  3. thesnowjunkies
    Member
    Posted 1 year ago #

    This does help, but the get parameter might be too complicated for me to figure out. Don't suppose anyone can point me towards some sample code?

Topic Closed

This topic has been closed to new replies.

About this Topic