Login   Register  
PHP Classes
elePHPant
Icontem

File: test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ashish Vishwakarma  >  Generate Paging  >  test.php  >  Download  
File: test.php
Role: Example script
Content type: text/plain
Description: It includes an example of paging class
Class: Generate Paging
Display MySQL query results split nto pages
Author: By
Last change: Some function changes
Date: 8 years ago
Size: 1,078 bytes
 

Contents

Class file image Download
<?
    
//create database test and run given sql file db.sql
    //connect your host
    
mysql_connect("localhost");
    
//your database name
    
mysql_select_db("test");
    include(
"paging.php");
?>
<html>
<head>
<title>Test Paging</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body>
<?
    $Obj
=new Paging("select * from hotel where status='a'");
    
$Obj->setLimit(10);
    
$limit=$Obj->getLimit();
    
$offset=$Obj->getOffset($_GET["page"]);
    
$Obj->setParameter("&name=Test&address=India");
    
//set link css
    
$Obj->setStyle("redheading");
    
$Obj->setActiveStyle("smallheading");
    
$Obj->setButtonStyle("boldcolor");
?>
<table border="1">
  <?
    $sql
="select * from hotel where status='a' order by hotel_name limit $offset,$limit";
    
$rs=mysql_query($sql);
    while(
$row=mysql_fetch_array($rs)) {
?>
  <tr> 
    <td class="bodytext"> 
      <?=$row[hotel_name]?>
    </td>
  </tr>
  <?
    
}
?>
</table>
<?
    
//get page links
    
$Obj->getPageNo();
?>
</body>
</html>