Audunfr Audunfr - 7 months ago 19
MySQL Question

Query from to date with php in mysql

I have a date field in a mysql table formatted like this: Y-m-d.

I want to export every post that has a date between $fromDate and all the way to $toDate
I am sure its easy but now i am totaly blocked from ideas.

I am using codeigniter if that helps.

Best Regards


Try building a query similar to this and passing it to mysql_query (assuming your date format in $fromDate and $toDate match the date format of your mysql column)


$query="SELECT * FROM table WHERE date BETWEEN '$fromDate' AND '$toDate'";