Forum Moderators: coopster
this my idea..
limit = 4
back 5 6 7 8 forwardon click forward
9 10 11 12on click backward
1 2 3 4
his my code
function StudentPagination($offset)
{
$sqlQuery = "SELECT StudentID FROM students";
$result = mysql_query( sprintf( $sqlQuery ) );$MaxValue = mysql_num_rows($result);
$MaxPerPage = 15;
$OffSet = 0;
$onSet = 0;
$PageCounter = 1;
$TotalPages = ceil( $MaxValue / $MaxPerPage );
$cutTotalpages = ($TotalPages = 3);echo $TotalPages;
if ($MaxValue >= 10)
{
$rdata = '<div>Total Students: <b>'.$MaxValue.'</b> <br>Page: <font style="font-weight: bold; font-size: 12px;">';
for ($i = 0; $i < $TotalPages; $i++)
{
$OffSet = $MaxPerPage * $i;if ($OffSet == $offset)
{
$rdata .= ' '.($i + 1).' ';
}
else
{$rdata .= '<a href="index.php?option=students&page='.$OffSet.'">'.($i + 1).'</a>';
}
}
}
else if($cutTotalpages >= 3){
for ($r = 0; $r < $cutTotalpages; $r++)
{
$onSet = $MaxPerPage * $r;if ($onSet == $OnSet)
{
$rdata .= ' '.($r + 1).' ';
}
else
{$rdata .= '<a href="index.php?option=students&page='.$onSet.'">Forward</a>';
}
}}
else
{
return ' ';
}return $rdata .='</font></div>';
}
if problems persist consult an expert ^^
tnx :D