PHP paging system: Navigation for dynamic content!
 
A paging navigation is the navigation bar like google has, where you have links for all the sites, that matched your search.
Here is the code example of that system which I used on my site.

At the top of the page
<?php
// --------------------------------
// Paging
// --------------------------------
//current page:
if($HTTP_GET_VARS['page'] == "") { $HTTP_GET_VARS['page'] = 1; }
//all entries
$paging_totalentries = mysql_num_rows(mysql_query('SELECT * FROM table'));
//entries per page:
$paging_perpage = "30";
//amount of sites:
$paging_pages = ceil($paging_totalentries / $paging_perpage);
//start at:
$paging_offset = (($HTTP_GET_VARS['page'] - 1) * $paging_perpage);
// --------------------------------
?>

As you can see, I used a database query on my mysql database to see how many entrys are inside the table. That lets me know how many sites I have to create out of the content....)

Listing the content
$sql = "SELECT * FROM table LIMIT ".$paging_offset.",".$paging_perpage;

Displaying all the entries for page "x" works with the SQL "LIMIT" implementation.

The nvaigation box at the bottom
<?php
// --------------------------------
// Paging
// --------------------------------
echo "<div align="right"><b>Page: ";
for($i=1;$i<=$paging_pages;$i++)
{
if($i == $HTTP_GET_VARS['page'])
{
echo $i;
}
else
{
echo "<a href="?page=".$i."">".$i."</a>";
}
if($i != $paging_pages)
{
echo ", ";
}
}
echo "</b></div>";
// --------------------------------
?>
 
admin / Dec 01, 2005
   
 
 
Login: 
Pass: 
 
 
     
     
2004 - 2019 / lookass.ch
makememad@lookass.ch