Login   Register  
PHP Classes
elePHPant
Icontem

File: paging.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of imran ahmed rahi  >  Paging Class  >  paging.php  >  Download  
File: paging.php
Role: Example script
Content type: text/plain
Description: The example script
Class: Paging Class
Display MySQL query results split in pages
Author: By
Last change:
Date: 2005-03-15 04:57
Size: 803 bytes
 

Contents

Class file image Download
<?php
include "DbConnection.php";
include 
"pagingClass.php";

$Dbcon = new DbConnection();
# number of records per page
$limit 3;


$sql "SELECT name FROM employee ";
$result $Dbcon->ExecuteQuery($sql);
if(
$Dbcon->NumRows($result) > 0)
{
    
$totrecords $Dbcon->NumRows($result);
    
$totpages ceil($totrecords $limit);
}

if(!isset(
$page))
{
    
$page 1;
    
$offset 0;
}
else
    
$offset = ($page-) * $limit;

$sql "SELECT name FROM employee LIMIT $offset,$limit";
$result $Dbcon->ExecuteQuery($sql);
if(
$Dbcon->NumRows($result) > 0)
{
    
$paging = new PagingClass2($totrecords$limit);
    
$data $paging->DisplayPaging($page);
}
print 
$data."<br>";
while(
$rows $Dbcon->FetchArray($result))
{
        print 
$rows[0]."<br>";
}
$Dbcon->FreeResult($result);
?>