Reputation: 719
how to fetch data between two dates in php
$this->db->select('*');
$this->db->from('table_name');
this-> db ->where('t_deadline' between $start_deadline and $end_deadline);
but this query not execute.
Upvotes: 1
Views: 17244
Reputation: 2125
Try this one:
$this->db->select('*');
$this->db->from('table_name');
$this->db->where('t_deadline >=', $start_deadline);
$this->db->where('t_deadline <=', $end_deadline);
$query = $this->db->get();
$result = $query->result();
print_r($result);
Upvotes: 0
Reputation: 372
$this->db->where('order_date >=', $first_date);
$this->db->where('order_date <=', $second_date);
return $this->db->get('orders');
Upvotes: 3