Location: PHPKode > projects > PHP Enter > www/admin/menage.php
<?php include('header.php');include('options.php'); ?>
<table width="97%" text align="center" border="0">
<tr><td align="left" width="320"><center><h3>Listing Detail</h3></center><br />
<?php
$rowsPerPage = 15;
$pageNum = 1;
if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
$offset = ($pageNum - 1) * $rowsPerPage;
$result = mysql_query("SELECT * FROM newser ORDER by blogid desc LIMIT $offset, $rowsPerPage") 
or die(mysql_error()); 
while($row=mysql_fetch_array($result))
{
echo "<font size=\"2\">$row[btexty]</font><br /><a href=\"deletenews.php?id=$row[blogid]\"><font color=\"red\">Delete Link</font></a>";
echo "- <a href=\"editnews.php?id=$row[blogid]\">Edit Link</a><br /><br />";
}
$query   = "SELECT COUNT(blogid) AS numrows FROM newser";
$result  = mysql_query($query) or die('Error, query failed');
$row     = mysql_fetch_array($result, MYSQL_ASSOC);
$numrows = $row['numrows'];
$maxPage = ceil($numrows/$rowsPerPage);
$self = $_SERVER['PHP_SELF'];
$nav  = '';
for($page = 1; $page <= $maxPage; $page++)
{
   if ($page == $pageNum)
   {
      $nav .= " $page "; // no need to create a link to current page
   }
   else
   {
      $nav .= " <a href=\"$self?page=$page\">$page</a> ";
   } 
}
if ($pageNum > 1)
{
   $page  = $pageNum - 1;
   $prev  = " <a href=\"$self?page=$page\">[Prev]</a> ";
   $first = " <a href=\"$self?page=1\">[First Page]</a> ";
} 
else
{
   $prev  = '&nbsp;';
   $first = '&nbsp;'; 
}
if ($pageNum < $maxPage)
{
   $page = $pageNum + 1;
   $next = " <a href=\"$self?page=$page\">[Next]</a> ";
   $last = " <a href=\"$self?page=$maxPage\">[Last Page]</a> ";
} 
else
{
   $next = '&nbsp;'; 
   $last = '&nbsp;'; 
}
echo $first . $prev . $nav . $next . $last;
 
?>
Return current item: PHP Enter