How to query sql with active record for dates between specified times
this is the way . but according to the DATE format you have in the database you have to change 2012-10-01
and 2012-10-03
$this->db->select('*');
$this->db->from('topics_list');
$this->db->where('order_datetime <','2012-10-03');
$this->db->where('order_datetime >','2012-10-01');
$result = $this->db->get();
You can specify you $where and use active records
$this->db->group_start()
->or_where("product_order.generate_date >= ","$start_date")
->or_where("product_order.generate_date <","$end_date + INTERVAL 1 DAY")
->group_end();
You can specify you $where
and use active records
$where = "DATE(order_datetime) BETWEEN '2012-10-01' AND '2012-10-3'";
$this->db->where($where)->get('table_name');
`$where = array(
"order_datetime <" => "2012-10-03",
"order_datetime >" => "2012-10-01"
);
$this->db->select("*")->get_where("topics_list" , $where)`