<?
 
    $dbhost = 'localhost';
 
    $dbuser = 'root';
 
    $dbpass = '';
 
    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
 
 
    $dbname = 'databasename';
 
    mysql_select_db($dbname);
 
    include("Paging.php");
 
?>
 
<html>
 
<head>
 
<title>Test Paging</title>
 
<link href="stylesheet.css" rel="stylesheet" type="text/css">
 
</head>
 
<body>
 
 
<?
 
    // This code must be put before the form tag
 
    
 
    $Obj=new Paging("select * from tablename");
 
    $Obj->setLimit(5);//set record limit per page
 
    $limit=$Obj->getLimit();
 
    $offset=$Obj->getOffset($_REQUEST["page"]);
 
    //below is optional parameter 
 
    $Obj->setParameter("&name=Test&address=India");
 
    //set link css
 
    $Obj->setStyle("redheading");
 
    $Obj->setActiveStyle("smallheading");
 
    $Obj->setButtonStyle("boldcolor");
 
//End Here
 
 
?>
 
<form >
 
<table border="1">
 
  <?
 
    $sql="select * from tablename limit $offset,$limit";
 
    $rs=mysql_query($sql);
 
    while($row=mysql_fetch_array($rs)) {
 
?>
 
  <tr> 
 
    <td><?=$row[fieldname]?></td>
 
  </tr>
 
  <?
 
    }
 
?>
 
</table>
 
</form>
 
<?
 
    // This code Must be put After the Form tag
 
    //get page links
 
    $Obj->getPageNo();
 
?>
 
</body>
 
</html>
 
 |