Getting data posted in between two dates

Thomas John picture Thomas John · Feb 2, 2011 · Viewed 147.9k times · Source

How can I retrieve data from the database by querying records between two dates using CodeIgniter's activerecord?

Answer

Teej picture Teej · Feb 2, 2011

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');