Login   Register  
PHP Classes
elePHPant
Icontem

File: showresult.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of shijith  >  A simple pagination using MySQL  >  showresult.php  >  Download  
File: showresult.php
Role: Example script
Content type: text/plain
Description: An examle file
Class: A simple pagination using MySQL
Split MySQL query results in multiple pages
Author: By
Last change:
Date: 2008-08-06 02:29
Size: 884 bytes
 

Contents

Class file image Download
<?php
/***
File name : showresult.php -- an example file
Description : Shows the result in page wise
Author : Shijith. M
Date : 6th August 2008
***/
include_once("pagination.class.php");  // include main class filw which creates pages
$pagination    =    new pagination();
$query    =    "SELECT * FROM `student` WHERE 1"// write the database query
/*
Call function that creates the pages
@param - database query
@param - Total number of records per page
*/
$pagination->createPaging($query,10);
echo 
'<table border="1" width="400" align="center">';
while(
$row=mysql_fetch_object($pagination->resultpage)) {
    echo 
'<tr><td>'.$row->name.'</td><td>'.$row->age.'</td></tr>'// display name and age from database
}
echo 
'</table>';
echo 
'<table border="1" width="400" align="center">';
echo 
'<tr><td>';
$pagination->displayPaging();
echo 
'</td></tr>';
echo 
'</table>';
?>