<?php
//------------------------Data Base Connection
//Mysql Server
$servidor_mysql = "localhost";
//User
$usuario_banco = "root";
//Password
$senha_banco = "";
//Database Name
$nome_banco = "livrophp";
$_DATABASE = array('dbdriver' =>'mysql','dbhostname'=>$servidor_mysql,'dbusername'=>$usuario_banco,'dbpassword'=>$senha_banco,'dbname'=>$nome_banco);
$conn = new PDOPaginator($_DATABASE["dbdriver"].":host=".$_DATABASE["dbhostname"].";dbname=".$_DATABASE["dbname"],$_DATABASE["dbusername"],$_DATABASE["dbpassword"]);
$conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
//------------------------Executing Queries
//Your Sql Here
$sql = "select * from users";
$max_records_per_page = 300;
$max_navigation_numbers = 20;
$cache_session_name = "my_session";
$conn->prepareLimit($sql,$max_records_per_page,$max_navigation_numbers,$cache_session_name);
$users = $conn->execute();
while($line = $users->fetch(PDO::FETCH_ASSOC);){
echo $line["nm_user"];
}
//------------------------Showing the Paginator
//Normal Links
echo $conn->getLinks("default");
//Ajax Links
echo $conn->getLinks("ajax");
//Friendly Url Links
echo $conn->getLinks("friendlyUrl");
?>
|