Hi there,
I have a drop down list that holds the following options:
"today", "this week", "this month", "this year".
Is it possible to get records from a mysql database based on what the user chooses from the above drop down using only one query?
I know that using something like that:
SELECT * FROM table WHERE (month(DATEFIELD) = month(now()) and dayofmonth(DATEFIELD) = (dayofmonth(now())) and year(DATEFIELD)=year(now()));
I can retrieve today's records. So, one solution would be to create multiple queries and based on user input, execute the associated query. But given the fact that my form has various search criteria, i will end up with to many queries.
Any help would be very much appreciated.
Thanks.