Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2009
    Posts
    152
    Thanks
    8
    Thanked 0 Times in 0 Posts

    How to add a pager to the page with php?

    I'm new to PHP and I'd like to add a pagination function to the page.

    I have this piece of code:

    Code:
    $result = mysql_query( "select title from post LIMIT 5 OFFSET 0");
    while ($row = mysql_fetch_object($result)) {
        echo $row->title;
    }
    $total is all the rows.

    I'd like to show only five post titles per page. If I want to add a pager to this page, how do I do this? E.g: the URL is example.com/post.html.

  • #2
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    This has been asked many times before if you search this forum or Google.
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS


  •  

    Posting Permissions

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