$page = empty($_GET['page'])?1:intval($_GET['page']);//检测get参数
if($page<1) $page=1;//如果不足1页,按1页算
$count = DB::result(DB::query("select count(*) from ".DB::table('home_order')." where uid ='$_G[uid]' AND isorder = 0"),0);//查询多少条记录
$perpage = 10;//每页多少条记录
$perpage = mob_perpage($perpage);
$start = ($page-1)*$perpage;这两步是计算limit后面的两参数
ckstart($start, $perpage);// - -! 看的不是太明白
$theurl = 'home.php?mod=space&do=order&view=me';//设置地址
$sql = "select orderid,company,quotedprice,count,tatol,otime from ".DB::table('home_order'). " where uid ='$_G[uid]' AND isorder = 0 order by orderid desc LIMIT $start,$perpage ";//按根据前面设置的分页设置,能过limit查询结果
$query = DB::query($sql);
$record = array();
while($row = DB::fetch($query)){
$record[] = array(
'company' => $row['company'],
'quotedprice' => $row['quotedprice'],
'count' => $row['count'],
'tatol' => $row['tatol'],
'otime' => $row['otime']
);
}//格式化查询结果,用于前台循环显示
$multi = multi($count, $perpage, $page, $theurl);//生成分页导航
discuz X1.5分页
最新推荐文章于 2021-03-25 00:29:39 发布