Feed on

Based on feedback (and the long time between updates), I’m releasing an updated version of the PHP pagination class.


  • No more SQL errors if using the class on a query with no results (although I fail to see the point of using it on an empty query anyway, but the bug is fixed)
  • When selecting ‘ALL’ only one page is displayed, and if you are using the display_items_per_page drop-down menu, ‘ALL’ is now selected as well.
  • If a page less than page one, or greater than the total number of pages is requested, no results are displayed and the appropriate prevous/next links are disabled
  • The items per page array that populates the display_items_per_page drop-down menu is now an option that can be configured when instantiating the class. Previously this was hard-coded to the class.
  • The $high option has been removed from the class (it was never used).

Note that if you receive a PHP notice about undefined indexes that you should turn down your error reporting. This notice may be displayed when loading the page for the first time when no $_GET variables are present. The class accounts for this, however PHP throws a notice about it.


I’ve also added license info at the head of the class (CC Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)).


67 Responses to “PHP Pagination Class Updated – Version 2”

  1. david olson says:

    This class should have url insert options like
    $pages->url = index.php?do=test;

    currently it shows my page like so http://www.test.com/index.php?page=1&ipp=5&do=test

  2. Randy says:

    Hi, i have inserted your function to my website, but it show erros when installed on IIS server using PHP 5.14, Perhaps, your php function is not compatible with PHP-IIS

    any suggesstion? thank you.

  3. andris says:

    Tried example-form.php but when I use continent from drop-down menu, nothing displayed and drop-down menu text returns to : Please select a continent

  4. Rafael says:

    Thanks, perfect!

  5. Vishaal says:

    Hello There,
    It’s very nice , But i want to export the data to excel , Will you please suggest on the same.

  6. Sheeshkamal says:

    Hi Admin,

    There is lot of error
    Notice: Undefined variable: option in C:\xampp\htdocs\sattvic\page\paginator.class.2.php on line 119

    Notice: Use of undefined constant ipp – assumed ‘ipp’ in C:\xampp\htdocs\sattvic\page\paginator.class.2.php on line 111

    Notice: Undefined property: Paginator::$high in C:\xampp\htdocs\sattvic\page\example.php on line 115

    Could you please help me on this?

    • admin says:

      I have an entirely new version in the works, but in the mean time you can turn your error reporting down — those are just notices.


  1. [...] (Oct 25, 2011): Version 2 now available for download. See here for more info. Note that the examples on this page still use an older version of the [...]

  2. [...] PHPÚltimamente ando revisando mis posts antiguos y en esta ocasión quería mostrarles una clase de paginación echa en PHP que es más fácil y prolija de usar que el código de Paginación PHP que publique hace tiempo. [...]

  3. [...] 1.9.0) Infinite Scrolling (JQuery Plugin) MySQL World Database (Importing can take some time!) Pagination Class (v2!) (Default Styles for Pagination [...]

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>