user3056158
user3056158

Reputation: 719

In codeigniter how can i find data between two dates

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

Answers (2)

Indrasinh Bihola
Indrasinh Bihola

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

Dhruvin Sukhadiya
Dhruvin Sukhadiya

Reputation: 372

$this->db->where('order_date >=', $first_date);
$this->db->where('order_date <=', $second_date);
return $this->db->get('orders');

Upvotes: 3

Related Questions