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

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -