elioncho Posted October 7, 2006 Share Posted October 7, 2006 Hi,Suppose I have a table like this oneID DATE NAME1 2006-10-03 ELIAS2 2006-10-04 ELIAS3 2006-04-07 JOHNI want the user to be able to do a search 'by month' by selecting a month from a selection list. How can I compare the month the user chooses with the month in the DATE Format stored in the database? I there an esay way to compare the DATE format with a month?Thanks,Elías Quote Link to comment https://forums.phpfreaks.com/topic/23318-help-in-date-query/ Share on other sites More sharing options...
Firemankurt Posted October 9, 2006 Share Posted October 9, 2006 SELECT *FROM `table`WHERE `DATE` LIKE '%-12-%' Quote Link to comment https://forums.phpfreaks.com/topic/23318-help-in-date-query/#findComment-106058 Share on other sites More sharing options...
fenway Posted October 9, 2006 Share Posted October 9, 2006 [quote author=Firemankurt link=topic=110842.msg449066#msg449066 date=1160362049] SELECT *FROM `table`WHERE `DATE` LIKE '%-12-%'[/quote]Please don't -- use the MONTH() function that was designed for this purpose. Quote Link to comment https://forums.phpfreaks.com/topic/23318-help-in-date-query/#findComment-106108 Share on other sites More sharing options...
elioncho Posted October 9, 2006 Author Share Posted October 9, 2006 thanks, :P Quote Link to comment https://forums.phpfreaks.com/topic/23318-help-in-date-query/#findComment-106446 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.