I want to retrieve data between two dates in mysql.
from date : 01/04/2015
to date : 01/05/2015
but i cant get date these in single variable;
how i am get as below mentioned:
$fdate=01;
$fmonth=04;
$tdate=01;
$tmonth=05;
$year=2015;
my code in model :
function date_range($fdate,$fmonth,$tdate,$tmonth,$year)
{
$this->db->select('*');
$this->db->where('DAY(order_date) >=',$fdate);
$this->db->where('MONTH(order_date) >=',$fmonth);
$this->db->where('YEAR(order_date) >=',$year);
$this->db->where('DAY(order_date) <=',$tdate);
$this->db->where('MONTH(order_date) <=',$tmonth);
$this->db->where('YEAR(order_date) <=',$year);
return $this->db->get('orders');
}
some times it return results properly, and some times it not return result, but i had an data in mysql between mentioned two dates.
what mistake i make on this code please help me