$pageTotal = $db->get_var("select count(*) from tb");
//每次显示的页数
$sub_pages = 10;
//得到当前是第几页
if (is_array($_GET) && count($_GET) > 0) {
if (isset ($_GET["p"])) { //是否存在"id"的参数
$pageCurrent = $_GET["p"];
}
} else {
$pageCurrent = 1;
}
$goodses = $db->get_results("SELECT g.id,* FROM tb as g INNER JOIN (select id from tb order by updatetime desc limit " . ($pageCurrent -1) * $pageSize . ",10 )as g1 ON g.id=g1.id");
显示分页数据
<?php $subPages = new Pagination($pageSize, $pageTotal, $pageCurrent, $sub_pages, "index.php?p=", 2);?>