【发布时间】:2017-07-27 19:47:09
【问题描述】:
这是我的 index.php 代码 我的问题是我的分页有连续的数字 页。
<?php
$limit = 10;
$offset = (isset($_GET["page"]) ? $_GET["page"] - 1 : 0) * $limit;
$query = "SELECT * FROM employee ORDER BY employee_datecommenced ASC LIMIT
$offset,$limit ";
$list = getdata_inner_join($query);
?>
<?php
$total = $dbcon->query("SELECT count(*) FROM employee") or
die(mysqli_error());
$fetch = $total->fetch_assoc();
for($x = 0; $x < $fetch["count(*)"] / $limit ; $x ++){
$page = $x + 1;
if((isset($_GET["page"]) ? $_GET["page"] : 1) == $page)
$page = "<b>".$page."</b>";
echo '<a href="?page='.($x + 1).'"style="padding:2px;">'.$page.'</a> ';
}
?>
Click here to see the output photo
提前致谢
【问题讨论】:
标签: php mysqli pagination