PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Ron Darby   Database Pagination   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Sample usage
Class: Database Pagination
Paginate database query result listings
Author: By
Last change: Added where explanation
Date: 11 years ago
Size: 565 bytes
 

Contents

Class file image Download
<?php

include('db.class.php');
include(
'pagination.class.php');

$host = 'localhost';
$dbName= 'db_name';
$user = 'user_name';
$pass = 'db_user_pass';

$db = db::getInstance($host,$dbName,$user,$pass);
$pagination = new pagination($db);

$sql = "SELECT * FROM `table_name`";
$pagination->sql = $sql;

//Example of setting the WHERE clause seperate if you like
$where = "WHERE `timestamp` < '".time()."'";
$pagination->where = $where;




$result = $pagination->result();
//print_r($result);
$links = $pagination->pager();
//echo $links;