How can I retrieve data from the database by querying records between two dates using CodeIgniter's activerecord?
This looks like what you need:
$this->db->where('order_date >=', $first_date);
$this->db->where('order_date <=', $second_date);
return $this->db->get('orders');