Added the compatibility with url.
$cnt= 100; //set to value in database
$currentpage = $_GET['page'];
$currentpage = 1; // Whatever you wanna use.
$current = 1;
$limit = 20; //Or set to other value, or user defined.
while($current <= $cnt)
$thislast = $current + $limit;
$url = "?page=" . $currentpage;
if($thislast > $cnt)
$thislast = $cnt;
if($current == ((($currentpage - 1) * 20) + 1))
echo '<p class = "paginationBold">'. $current . ' - ' . $thislast . '</p>';
echo '<a class = "paginationLink" href = "http://localhost/testing.php?page=' . ((int)($current / 20) + 1) . '">' . $current . ' - ' . $thislast . '</a>' ;
$current += $limit; //Added this to update $current. Was missing.
Originally Posted by mfoland
I got it figured out.. but My start = 0 should be showing 1-20 on the pagination but it's showing 1-21.. Very interesting!
1 + 20 = 21
But you can easy fix that.