<?php
if (isset($_GET['page'])) {
$pageno = $_GET['page'];
} else {
$pageno = 1;
}
$getPages = "SELECT COUNT(steamid) FROM player_time";
$rs_result = mysql_query($getPages, $sql);
$row = mysql_fetch_row($rs_result);
$total_records = $row[0];
$total_pages = ceil($total_records / 10);
$printed_ellipsis = false;
for ($i=1; $i<=$total_pages; $i++) {
if($i > 4 && !$printed_ellipsis)
{
echo "…"; //printing the ellipsis
$i = max(0, $total_pages - 3);
$printed_ellipsis = true;
}
if($i == $pageno)
{
echo "<span class='current-page'>$pageno</span>";
}
else
{
echo "<a class='paginations' href='index.php?page=".$i."'>".$i."</a> ";
}
};
?>
输出:1 2 3 4 ... 76 77 78 79
当我到达第4页时,5,6,7,8 ....不会出现。所以基本上我被困在第4页,没有可能进入第五,第六等等。
这里有什么问题?