retrieve data from MySQL between two date ranges
I have to retrieve data based on two date ranges, please help, my current Query should retrieve all records but it displays no records?
on submit, I have 2 date ranges in the $_POST data : $datefrom & $dateto in this format = 01-01-2014 ( dd/mm/yyyy )
in the table I am trying to query, I have a column called e_date ( dd/mm/yyyy ) saved as a string.
this is my query which is not retrieving any info nor generating any errors, I can't figure this one out, please help
my query :
$query="SELECT * from MYTABLE where client_id=$client AND STR_TO_DATE(e_date, '%d/%m/%Y') BETWEEN STR_TO_DATE($datefrom, '%d-%m-%Y') AND STR_TO_DATE($dateto, '%d-%m-%Y')";