i am trying to create a MySQL query that will take current date and compare it to the 2 date fields that i have in my table and return the rows that satisfy that query.
here is my columns 1- [from_date] which type is Date 2- [to_date] which also holds type Date
the query suppose to return the rows that falls in between those dates.
here is my query
mysql_query("SELECT * FROM location WHERE from_date >= DATE() AND to_date <= DATE()")
my problem is that it doesn't return anything. should i switch my column type to DATETIME?
Thanks in advance.
You should use
Now() to get the current date of the system.
See documentation here.
mysql documentation here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!Donate Us With