require 'PaginationFactory.php'; //Set the number of records per page $records_per_page = 10; //MySQL Query $results_query = "SELECT * FROM users ORDER BY id DESC"; //Instantiate PaginationFactory object $pagination = new PaginationFactory(); //Set the pagination parameters $pagination->set_records_per_page($records_per_page); $pagination->set_sql_query($results_query); $pagination->set_database_connection($db_conn); $pagination->set_pagination_link("results.php"); //Render the pagination on the page echo $pagination->paginate();
require 'PaginationFactory.php'; //Set the number of records per page $records_per_page = 5; //MySQL Query $results_query = "SELECT * FROM posts ORDER BY id DESC"; //Instantiate PaginationFactory object $pagination = new PaginationFactory(); //Set the pagination parameters $pagination->set_records_per_page($records_per_page); $pagination->set_sql_query($results_query); $pagination->set_database_connection($db_conn); $pagination->set_pagination_link("results.php"); $pagination->set_use_ajax(true); //Render the pagination on the page echo $pagination->paginate();`This library is an open-source package library written in PHP and available on GitHub as a standalone package for developers.