如何以codeigniter方式在连接查询中传递offset和per_page变量

时间:2015-05-03 16:44:02

标签: codeigniter activerecord

如何在以下查询中传递偏移和perpage计数

import datetime as d

def task():
    print "I'm doing something!"

#10 seconds from now
END_TIME = d.datetime.now() + d.timedelta(seconds=10)

while d.datetime.now() < END_TIME:
    task()

print "hello after 10 seconds"

1 个答案:

答案 0 :(得分:0)

是的,我尝试过限制..感谢

以下是代码

        $this->db->select('*');    
        $this->db->from($this->table1);
        $this->db->join($this->table2, 'plot.location_id = locations.location_id');
        $this->db->join($this->table3, 'plot.plot_type = plot_types.plot_id');
        $this->db->join($this->table4, 'plot.user_id = admin.id');
        $this->db->order_by($this->table1.'.plot_id','DESC');
        $this->db->limit($per_page, $offset);
        $query = $this->db->get();
        return $query->result();