SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jan 2009
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to do Paging in PHP

    Dear All,

    I have a user table where several details of users are displayed.
    I wanted to display only 10 users at a time and give the user option to surf other users using paging in PHP.

    Anyone who knows how to do Paging in PHP.. Please help..

    Thanks in Advance...

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Do a little web searching and you'll find plenty of tutorials.

    The basic idea is simple. You pass the page number along in the query string of the PREVIOUS and NEXT links.

    From the page number, you compute the offsets for your database query (0,10 ... 10,10 ... 20,10 ... 30,10 ... 40,10 ... etc). You should see that the offset is (($page_number - 1) * 10).

    And put that in the query you generate
    Code:
    SELECT columns FROM table WHERE condition LIMIT offset, numperpage
    Nothin' here but addition and multiplication

  3. #3
    SitePoint Member
    Join Date
    Jan 2009
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Dan..
    I appreciate ur help...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •