Login   Register  
PHP Classes
elePHPant
Icontem

File: examples/pdo.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Mark Rolich  >  Extended Generic Pager  >  examples/pdo.php  >  Download  
File: examples/pdo.php
Role: Example script
Content type: text/plain
Description: Example of PDO pagination
Class: Extended Generic Pager
Paginate data listings from arrays, CSV or MySQL
Author: By
Last change:
Date: 2 years ago
Size: 461 bytes
 

Contents

Class file image Download
<?php
include '../Pager.php';
include 
'../PagerMySQL.php';

$pageNum = (isset($_GET['p']) && $_GET['p'] != '') ? (int)$_GET['p'] : 1;

$dbh = new PDO('mysql:host=localhost;dbname=pager_test''root''');

$dataOptions = array(
    
'handle' => $dbh,
    
'query' => 'SELECT * FROM data'
);

$pager = new PagerMySQL($pageNum);
$data $pager->getData($dataOptions);

$pagerNav $pager->render();

$pageTitle 'Pager - PDO example';
include 
'example.tpl.php';
?>