PHP Classes

File: examples/mysqli.php

Recommend this page to a friend!
  Classes of Mark Rolich   Extended Generic Pager   examples/mysqli.php   Download  
File: examples/mysqli.php
Role: Example script
Content type: text/plain
Description: Example of MySQLi pagination
Class: Extended Generic Pager
Paginate data listings from arrays, CSV or MySQL
Author: By
Last change: Update of examples/mysqli.php
Date: 6 months ago
Size: 452 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 mysqli('localhost', 'root', '', 'pager_test');

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

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

$pagerNav = $pager->render();

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