
Adeeyo Sulaiman Adesola - 2012-05-22 06:41:16 -
In reply to message 1 from Vivek Thomas
If I have a table 'members' in my database and i want to be able to browse this members on a page with 30 records per page then i will do the following:
<?php
// You must first of all do the db conn
$sql = 'SELECT * FROM members'
$pagintor = new MaximPaginator(30, $sql);
$vars = get_defined_vars();
$paginator->setDefinedVars($vars);
$query = $paginator->getQueryResource();
?>
<table>
<?php
while($array = mysql_fetch_array($query))
{
?>
<tr> <td><?php echo $array['fullname']; ?>
</td> <td><?php echo $array['email']; ?></td> </tr>
<?php
}
?>
</table>
<?php $paginator->displayNavigator(); ?>
The above code will display a table with 30 records and 2columns of fullname and username. The navigation link will be display below the table with default link-phrase i.e First, Prev, Next, Last. These can be changed using the function customiseNavigation().