<?php
 
#include "DbConnection.php";
 
include "pagingClass2.php";
 
 
# Your database connection object
 
$Dbcon = new DbConnection();
 
 
# number of records per page
 
$limit = 3;
 
 
$sql = "SELECT name FROM employee ";
 
$result = $Dbcon->ExecuteQuery($sql);
 
if($Dbcon->NumRows($result) > 0)
 
{
 
    # Total records in DB for the query
 
    $totrecords = $Dbcon->NumRows($result);
 
 
    # Possible total pages
 
    $totpages = ceil($totrecords / $limit);
 
}
 
 
if(!isset($page))
 
{
 
    $page = 1;
 
    $offset = 0;
 
}
 
else
 
    $offset = ($page-1 ) * $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);
 
?>
 
 
 |