Hi !!
I am having a problem with the page results.
My database has a lot of data, so in my page results it is showing over 30 pages but I would like to show the first 10 page numbers and then just add one more as I move to the next page number.
Maybe my script will make it clear:
[code=php]
<?
$total_results = mysql_result(mysql_query(“SELECT COUNT(*) as Num FROM accommodation”),0);
$total_pages = ceil($total_results / $max_results);
echo “<strong><font color=’#003366′ size=’2′>Pages: </font></strong>”;
if($page > 1){
$prev = ($page – 1);
echo “<a href=””.$_SERVER[‘PHP_SELF’].”?page=$prev&area=$area&acc_category_id=$category”><strong><font size=’2′>Previous</font></strong></a> ”;
}
for($i=1; $i <= $total_pages; $i++ ){
if(($page) == $i){
echo “<font color=’#FF6633′ size=’2′><strong>$i </font></strong>”;
} else {
echo “<a href=””.$_SERVER[‘PHP_SELF’].”?page=$i&area=$area&acc_category_id=$category”><strong><font size=’2′>$i<br></font></strong></a> ”;
}
}
if($page < $total_pages){
$next = ($page + 1);
echo “<a href=””.$_SERVER[‘PHP_SELF’].”?page=$next&area=$area&acc_category_id=$category”><strong><font size=’2′>Next>></font></strong></a>”;
}
echo “</center>”;
?>
As you can see above it keeps adding page numbers. How can I show only 10 page numbers just like google result page.
Thanks for any help
😮