PHP Classes

File: examples/mysql.php

Recommend this page to a friend!
  Classes of Mark Rolich   Extended Generic Pager   examples/mysql.php   Download  
File: examples/mysql.php
Role: Example script
Content type: text/plain
Description: Example of MySQL pagination
Class: Extended Generic Pager
Paginate data listings from arrays, CSV or MySQL
Author: By
Last change: Update of examples/mysql.php
Date: 1 month ago
Size: 477 bytes


Class file image Download
include '../Pager.php';

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

$dbh = mysql_connect('localhost', 'root', '');
mysql_select_db('pager_test', $dbh);

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

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

$pagerNav = $pager->render();

$pageTitle = 'Pager - MySQL example';