| Recommend this page to a friend! |
| Info | Example | Reputation | Support forum | Blog | Links |
| Ratings | Unique User Downloads | Download Rankings | ||||
| Not enough user ratings | Total: 636 | All time: 5,009 This week: 455 | ||||
| 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. |
| ||||||||||||||||||||||
<!-- TEST PAGE USING BOOTSTRAP --> |
<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!
| File | Role | Description | ||
|---|---|---|---|---|
| Conf. | Configuration script | |||
| Data | Auxiliary data | |||
| Data | Auxiliary data | |||
| Class | Class source | |||
| Doc. | Documentation | |||
| Example | Example script | |||
| The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
| 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.