PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Anderson Makiyama  >  PDO Paginator  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: PDO Paginator
Show links to browse query results got with PDO
Author: By
Last change:
Date: 11 years ago
Size: 1,221 bytes


Class file image Download
//------------------------Data Base Connection
//Mysql Server
$servidor_mysql = "localhost";

$usuario_banco = "root";

$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"]);

//------------------------Executing Queries

//Your Sql Here
$sql = "select * from users";
$max_records_per_page = 300;
$max_navigation_numbers = 20;
$cache_session_name = "my_session";

$users = $conn->execute();

$line = $users->fetch(PDO::FETCH_ASSOC);){

//------------------------Showing the Paginator
//Normal Links
echo $conn->getLinks("default");

//Ajax Links
echo $conn->getLinks("ajax");

//Friendly Url Links
echo $conn->getLinks("friendlyUrl");

For more information send a message to info at phpclasses dot org.