我是代码点火器新手,我已经完成了以下代码
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/