Categorized | PHP

PHP Tutorials: Pagination (Part 2)

Posted on 21 March 2010 by Abidoon


Visit the forum for help! phpacademy.info Follow on Twitter! twitter.com Paginating results from a mysql database. This is a (almost) simple method of showing paginated results effectively.

Tags | , ,

23 Responses to “PHP Tutorials: Pagination (Part 2)”

  1. AdamHamletKiani says:

    do you want a footrub mylord?

  2. neomg3 says:

    Great tutorial! I am using pagination to display the results from a seach and this tutorial saved my life. Bravo!

  3. 1337holiday says:

    awesome tutorial bro, i was stumped trying to do this on my own but i got it down now!

  4. CamiloSanchez1979 says:

    You should make the Object oriented version of this tutoria. Thanks though.

  5. dotsona07 says:

    What if I wanted to show a range of pages? How would I do that?

  6. PatrickWard4 says:

    That was extremely helpful as was the first part. Thank-you for taking your time to explain what everything was doing in a very clear way.

  7. Morcous16 says:

    @iamtheboat Put
    if($record_count > $per_page);
    {
    directly after the //show page numbers comment.
    Then put a } directly before the //show next button comment.

  8. gonzalezluis78 says:

    I learned more from you than watching that Lynda tutorial because you explain each step clearly and show us what happens if we mess up or if there is something lacking in our code. You are indeed a great teacher. Keep it up!

  9. iamtheboat says:

    I found these EXTREMELY useful, thank you so much! One question though:

    If there are fewer records returned than the maximum amount we want to display per page, is there an easy way of hiding the ’1′? The ‘next’ link doesn’t show up, which is good, but there’s still that ’1′ sitting there.

    Thanks
    Liam

  10. NickAncilleri2 says:

    Thank you this video was perfect. Keep up with the videos.

  11. richard92m says:

    Great tutorial, and I think what you were looking for at ~3:40 was 0,4 5,9 etc.

  12. skowne says:

    Works good unless users changes the url start-variable by themself.

    The best way of doing it is actually by having a page-variable instead of start, then if users changes it to 2 it would still show page 2, mysql rows 5-9. If a user changes the start-variable to 2, as the navigation works now, it would show mysql row 2-6.

    But why would users do that :)

    Thanks for another great tutorial!! Looking forward to part 3!!

  13. HititLee says:

    thanks for sharing Alex.

  14. TheSquiblo says:

    Alex your a true god! Any chance of merging search engine with pagination? ive tried fiddling with it but nothing is working, thank you

  15. andreyeu2008 says:

    I Love Your Forum

  16. Cezarijus says:

    I totally agree. I love they way he explains each part of the code so well. I learned most of the php from him and next semester I’m doing php so ill be like pro at it thanks to you tho.. = )

  17. eristars says:

    best php teacher on the internet!

  18. DavidBrHUN says:

    Thanks for the tutorial. It’s useful for my webpage now, especially on the news section.

  19. MrPinoynerd says:

    5 star again!!! :)

  20. damoned says:

    awesome tutorial alex!!!

  21. JamesRCoston says:

    Hi, Alex. Wow, you made that very easy. Mind was very messy and complicated. Do you like the idea of OOP PHP? Just wondering. xD

  22. Pivotanimatornall says:

    Is it possible to limit the number of link ? to 10 for an example?

    Prev 1 2 3 4 5 6 7 8 9 10 next
    If you’re on page 11
    Prev 11 12 13 14… 21 next

  23. SuppaSocca says:

    omg omg omg!!!11


Leave a Reply