Can anyone help how to displaing next and prev navbar. I want to display as follow
Found : 40 Displaying 1-15 Pages : 1 2 3 Next
<?
global $dbi;
$perpage=15;
$result = sql_query("select title,parentid from ".$prefix."_books_categories where cid=$cid LIMIT $perpage", $dbi);
$result = sql_query("select * from $prefix"._books." ", $dbi);
$numrows = sql_num_rows($result, $dbi);
$totalpages = ceil($numrows/$perpage);
if (!$page) {
$page = 1;
}
$start = ($page - 1) * $perpage;
$result = sql_query("SELECT bid,btitle,bauthor,bdesc,bimage, blink,bhits FROM ".$prefix."_books where cid=$cid order by bid limit $start,$perpage ", $dbi);
echo "Found :$numrows Displaying : ";
while(list($bid,$btitle,$bauthor, $bdesc, $bimage, $blink,$bhits) = sql_fetch_row($result, $dbi)) {
echo"<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" bgcolor=\"FFFFFF\" width=\"100%\">
<tr>
<td width=\"55\" align=\"right\" valign=\"middle\"><img src=\"images/books/rightarrow.gif\" width=\"16\" height=\"16\" hspace=\"10\"></td>
<td valign=\"middle\" align=\"left\">$bid .<a href=\"modules.php?name=Books&action=getit&bid=$bid\" >$btitle</a></td>
<td valign=\"top\" align=\"right\" rowspan=\"2\" ><a href=\"modules.php?name=Books&action=getit&bid=$bid\"><img src=\"images/books/$bimage\" border=\"0\"></a></td>
</tr>
<tr>
<td width=\"55\"></td>
<td valign=\"top\" >$bdesc<br><br><b>Author</b>: $bauthor <b>Total Hits: $bhits Category: $cid</td>
</tr>
</table>";
}
if ($totalpages >= 2) {
echo "<center>";
$back = $page - 1;
if ($back >= 1 ) {
echo "<a href=\"modules.php?name=Books&action=viewbooks&cid=$cid&page=$back\" class=\"content\"><< Back</a> ";
}
for ($i = 1;$i <= $totalpages;$i++) {
if ($page == $i) {
echo "<b>$page</b> ";
} else {
echo "<a href=\"modules.php?name=Books&action=viewbooks&cid=$cid&page=$i\" class=\"content\">$i</a> ";
}
}
$next = $page + 1;
if ($next <= $totalpages) {
echo "<a href=\"modules.php?name=Books&action=viewbooks&cid=$cid&page=$next\" class=\"content\"> Next >></a>";
}
echo "</center>";
}
?>