ѡ̳

 找回密码
 ע
搜索
查看: 69|回复: 0
打印 上一主题 下一主题

model类新增联合查询带分页的方法multi_listinfo

[复制链接]

789

主题

1158

帖子

4197

积分

Ա

Rank: 9Rank: 9Rank: 9

积分
4197
跳转到指定楼层
¥
发表于 2018-4-20 18:24:45 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
libs /  classes  / model.class.php  

新增
public function multi_listinfo($where = '', $page = 1, $pagesize = 20, $key='', $setpages = 10,$urlrule = '',$array = array()) {
        //$sql = preg_replace('/select([^from].*)from/i', "SELECT COUNT(*) as count FROM ", $where);
       // $this->query($sql);
       // $c = $this->db->fetch_next();      //$this->number = $c['count'];
       $this->query($where);
     $c = $this->count();  
     $this->number = $c;
        $page = max(intval($page), 1);
        $offset = $pagesize*($page-1);
        $this->pages = pages($this->number, $page, $pagesize, $urlrule, $array, $setpages);

        $r = $this->query($where.' LIMIT '.$offset.','.$pagesize);
        while(($s = $this->db->fetch_next()) != false){
            $data[] = $s;
        }
        return $data;
    }






回复

使用道具 举报

您需要登录后才可以回帖 登录 | ע

本版积分规则

QQ|Archiver|ֻ|С|ѡ̳

GMT+8, 2026-5-2 07:14 , Processed in 0.073426 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表
0.0866s