gpt4 book ai didi

php - 如何使用连接查询添加偏移量和限制?

转载 作者:行者123 更新时间:2023-11-29 04:00:04 24 4
gpt4 key购买 nike

我是 codeigniter 的新手,我已经完成了下面的代码

public function members($limit, $offset)
{
$this->load->model('Management/Member_model', 'member');
$this->db->reset_query();
$this->db->select('*');
$this->db->from($this->member->table);
$this->db->join('ib_communities_dtl','ib_communities_dtl.dtl_user_id='.$this->member->table.'.user_id','inner');
$this->db->join('ib_communities','ib_communities_dtl.dtl_community_id=ib_communities.community_id','inner');
$this->db->where('ib_communities.community_id', $this->community_id);

return $this->db->get()->result('Member_model');
}

我想在上面的查询中添加偏移量和限制,谁能帮我修改一下来实现?

提前致谢

最佳答案

public function members($limit, $offset)
{
$this->load->model('Management/Member_model', 'member');
$this->db->reset_query();
$this->db->select('*');
$this->db->from($this->member->table);
$this->db->join('ib_communities_dtl','ib_communities_dtl.dtl_user_id='.$this->member->table.'.user_id','inner');
$this->db->join('ib_communities','ib_communities_dtl.dtl_community_id=ib_communities.community_id','inner');
$this->db->where('ib_communities.community_id', $this->community_id);
$this->db->limit($limit, $offset);

return $this->db->get()->result('Member_model');
}

关于php - 如何使用连接查询添加偏移量和限制?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35594745/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com