PHP page numbering not displaying previous page numbers correctly -
PHP page numbering not displaying previous page numbers correctly -
i using code display previous page numbers , page number in between.
if current_page = 2
shows next page numbers:
1 1 2 3 4 5 6...
and same if current_page = 10
, show:
1 2 3 4 5 6 7 8 9 6 7 8 9... etc $range = 4; for($i = $current_page - $range; $i < ($current_page + $range) + 1; $i++) { if($i > 0 && $i <= $total_pages) { if($i == $current_page) { //$button_display.= ' [<strong>'.$i.'</strong>] '; $button_display.= ' <input type="button" value="'.$i.'" class="active" /> '; } else { $button_display.= ' <input type="button" onclick="parent.location=\'?page='.$i.'\'" value="'.$i.'" /> '; } } }
php
Comments
Post a Comment