PHP pagination class

About PHP Pagination class
This is a pagination class in PHP. This will be useful for pages showing table content from database page by page.

Package contains
3 variation of classes.
1. class.pagination1.php – This will show all pages as links for the table (For 1000 records, if showing 10 records each page then it will show 100 page links)
2. class.pagination2.php – Shows particular number of pages (For total 100 pages, on page 50, it can be showing 45 to 55 page links only)
3. class.pagination3.php – Like the previous one (pagination2), also takes care of the query string with the url. (If the url contains any query string like members.php?status=active the the next page url will be members.php?status=active&page=2)

Check and Usage
1. Set config file (for database connection)
2. Include pagination class in your php file
3. Define variables passing to class (current page, results per page, sql of full result, page links to display)
4. Create Object and populate data
5. Display $pageObj->get_links() somewhere in the page
6. Edit css file for page links appearance

Demo and Download
DEMO1 – All pages
DEMO2 – Particular pages
DEMO3 – With query string

DOWNLOAD

Cheers! ;)
Beschi A

About these ads
This entry was posted in PHP, Tutorial and tagged , , , , , , , , . Bookmark the permalink.

10 Responses to PHP pagination class

  1. Stefan Gabos says:

    Something very similar at http://stefangabos.ro/php-libraries/zebra-pagination/ very configurable, easily customizable from CSS, one file only, with documentation. Try it out and maybe it inspires in improving yours.

  2. Çetin says:

    Hi Beschi, great job!

    Is it possible to view?
    looks like:

    [1] … [10][11][12][13][14][15][16] … [500]

    Thanks

  3. Beschi says:

    Yes Cetin,
    edit the class file (line no 80 in class.pagination3.php) to get your result…

    Thank you.

  4. Hakan says:

    nice class. i would like to say thank you. you have been very helpful for me.
    i am sending my best regards and wishes to you

    move on my friend, you are good developer. post much more new classes. thanks once more

  5. Laura Daniel says:

    Great Work !!! TNX :)

  6. lefty says:

    hello sir,

    how can i make this to look like this?

    [First] [Prev] [1]…[11][12][13][14][15]…[100] [Next][Last]

    Thanks in advance…

  7. Arun says:

    how we can show row number…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s