View Single Post
Old 11-28-2012, 01:56 AM   PM User | #13
mfoland
New Coder

 
Join Date: Dec 2010
Posts: 28
Thanks: 4
Thanked 0 Times in 0 Posts
mfoland is an unknown quantity at this point
Quote:
Originally Posted by KULP View Post
I think everyone understands that style of pagination. The pagination would be simple.

Code:
$cnt= //set to value in database
$currentpage = $_GET['page']; // Whatever you wanna use.
$current = 1;
$limit = 20; //Or set to other value, or user defined.

while($current <= $cnt)
{
    $thislast = $current + $limit;
    if($thislast > $cnt)
    {
          $thislast = $cnt;
    }
    if($current = ((($currentpage - 1) * 20) + 1))
    {
          echo "<p class = 'paginationBold'>{$current} - {$thislast}</p>";
    }
    else
          echo "<a class = 'paginationLink' href = "insert url">{$current} - {$thislast}</p>";
}
Tried that and I got a blank page.. hmm. I even did the page = and went from there.
EDIT-- The Echo was wrong there.. but After fixing that, it would repeat 1-19 a ton of times. $cnt should be getting the total from the database.

Last edited by mfoland; 11-28-2012 at 02:09 AM.. Reason: Fixed blank page part but new error came about
mfoland is offline   Reply With Quote