phpcms分页查询
使用例子:
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
$memberlist = $this->db->listinfo('', 'userid DESC', $page, 15);
$pages = $this->db->pages;
echo count($memberlist,0);
echo json_encode($memberlist);
多条件例子代码:
//点数范围
if($point_from) {
if($point_to) {
if($point_from > $point_to) {
$tmp = $amount_from;
$point_from = $point_to;
$point_to = $tmp;
unset($tmp);
}
$where .= "`point` BETWEEN '$point_from' AND '$point_to' AND ";
} else {
$where .= "`point` > '$point_from' AND ";
}
}
if($keyword) {
if ($type == '1') {
$where .= "`username` LIKE '%$keyword%'";
} elseif($type == '2') {
$where .= "`userid` = '$keyword'";
} elseif($type == '3') {
$where .= "`email` like '%$keyword%'";
} elseif($type == '4') {
$where .= "`regip` = '$keyword'";
} elseif($type == '5') {
$where .= "`nickname` LIKE '%$keyword%'";
} else {
$where .= "`username` like '%$keyword%'";
}
} else {
$where .= '1';
}
} else {
$where = '';
}
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
$memberlist = $this->db->listinfo($where, 'userid DESC', $page, 15);
$pages = $this->db->pages;
文章来源: blog.csdn.net,作者:网奇,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/jacke121/article/details/55548790
- 点赞
- 收藏
- 关注作者
评论(0)