<?php
/*
Sample usage of Auto-Paging class
I'm sorry for my bad english...
hope the Auto-Paging class will be usefull for you...
if you have comments or feedback, you can send me an email... ^_^
*/
mysql_connect("localhost", "root", "") or die (mysql_error());
mysql_select_db("school") or die (mysql_error());
/*
Including the class file
*/
include "AutoPaging.php";
/*
first i create $page,
*/
$page = 1;
/*
Check if $_GET['page'] is exist or not,
if it exists, so i will use it as reference
for the current page that the class will generate
*/
if(isset($_GET['page']))
{
$page = $_GET['page'];
}
/*
use the class now... :D
*/
$paging = new AutoPaging("user", 2, $page);
/*
To get the content, just simply use getContent() function
here's the example... :D
its just simple example...
you can modify or even create a new one....
*/
foreach($paging->getContent() as $row)
{
echo $row['id'];
echo " : ";
echo $row['name'];
echo "<br />";
}
/*
the last but not least, here's how to get the pagination...
*/
echo $paging->getPaging();
?>
|