| 
<?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-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);
 ?>
 
 |