<?php
//控制分页
//分页
$pagesize=4;
$pagesql="SELECT COUNT(*) AS num FROM `{$DT_PRE}` company";
$r= $db->get_one("SELECT COUNT(*) AS num FROM `{$DT_PRE}` company`");
// var_dump($r);
$pages = pages($r['num'],$page,$pagesize);
$offset=($page-1)*$pagesize;
var_dump($offset);
$sql="SELECT * FROM `{$DT_PRE}company` ORDER BY `userid` DESC LIMIT $offset,$pagesize";
// echo "$sql";
$result = $db->query($sql);
while($r = $db->fetch_array($result)) {
$A[] = $r;
}
?>
-------------
前端:
<div class="pages">{$pages}</div>
<style type="text/css">
.pages{width: 1200px;margin: 0 auto;text-align: center;padding: 30px 0px;}
.pages a{padding: 5px 10px;border: 1px solid #D9D9D9;border-radius: 4px;font-size: 12px;color: rgba(0,0,0,0.65);margin: 0px 5px;}
.pages strong{padding: 5px 10px;border: 1px solid #108EE9;border-radius: 4px;font-size: 12px;color: #FFF;margin: 0px 5px;background: #108EE9;}
.pages cite{font-style: normal;margin-left: 10px;}
.pages_btn{display: none;}
.pages_inp{display: none;}
</style>