Download .zip |
Info | Example | View files (7) | Download .zip | Reputation | Support forum (2) | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2019-07-05 (2 hours ago) | Not enough user ratings | Total: 474 This week: 3 | All time: 5,869 This week: 92 |
Version | License | PHP version | Categories | |||
simplephppagination 1.0.2 | BSD License | 5 | HTML, PHP 5, Databases |
Description | Author | |||||||||||||
This class can display paginated database table records. |
|
<p align="center"> <img align="center" src="pag.png" width="100%" alt="pagination sample"/> </p>
This is a simple class that implements pagination when connected to a mysql databse via PDO.
- Include the class - Set the name of your table, number of items per page - edit the ouputted html however you want and voila !
It is really easy to set up. No hassle or stress.
To work properly, the class needs:
This class requires PHP 5 + to run.
Download and extract (https://github.com/sayopaul/paginationclass).
Set your config.php file
<?php
//set your database comnfiguration here. Ensure to fill in the username and password if there is any.
define("DSN","mysql:host=dbhost;dbname=dbname");
define("USER","username");
define("PASS","password");
After that, you create a new PDO object with the config details
<?php
//!important ---- require the config file and the Pagination class
require "config.php";
include "Pagination.class.php";
//initialize PDO connection and save object to $db
try{
$db=new PDO(DSN,USER,PASS);
}catch(PDOException $e){
echo "could not connect because of " .$e ;
}
//pass the pdo object,the number of listings per page, and the table name to the class.
$paginate = new Pagination($db,5,"customers");
//call the paginate methods
$test =$paginate->paginate();
//print out the returned result
echo $test;
There's a test file using bootstrap that shows a proper example
Want to contribute? Great! Please star and help to identify areas to improve. Thanks
MIT
Free Software, Hell Yeah!
Files |
File | Role | Description | ||
---|---|---|---|---|
css (1 file) | ||||
config.php | Conf. | Configuration script | ||
database.sql | Data | Auxiliary data | ||
pag.png | Data | Auxiliary data | ||
Pagination.class.php | Class | Class source | ||
readme.md | Doc. | Documentation | ||
test.php | Example | Example script |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Comments (1) | |||||
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.