Pagination System

Simple AJAX Pagination

This is a simple AJAX pagination system I made as a small side-project.

The core is a single PHP class that takes an instance of my own database class, but could easily be change to just taking a PDO or mysqli instance.

Then the class is called on the page that the AJAX loads using the jQuery .load() function.

In this case, after calling the class and passing the database connection, you'll have to run a couple of methods passing in the database table and the number of entries to be shown per page.

Then you loop through the results to output the data to the user and finally call a method to generate the links at the bottom of the page.

Demo

Source

I have also used this class in my News CMS.

Sandbox