dadamssg Posted February 1, 2009 Share Posted February 1, 2009 im storing events in my database with start datetimes and end datetimes...they can span a few minutes or days..just depends. Im trying to get a query that will pull up all the events that are goin on on a particular day, i can't seem to get the format right for the date though. This query works for pulling up everything today but when i try to switch curdate() to an actual date like (2009-02-2) it'll go through but won't pull up anything when theres things to pull up. SELECT * FROM test WHERE DATE(start) <= CURDATE() AND DATE(end) >= CURDATE() ORDER BY start ASC question 2 is, for the query above...how would i change the curdate() to also include the time so the query won't pull up events that are today but have already ended? Quote Link to comment https://forums.phpfreaks.com/topic/143386-2-questions/ Share on other sites More sharing options...
revraz Posted February 1, 2009 Share Posted February 1, 2009 Compare it to NOW() instead of CURDATE. Quote Link to comment https://forums.phpfreaks.com/topic/143386-2-questions/#findComment-752107 Share on other sites More sharing options...
dadamssg Posted February 1, 2009 Author Share Posted February 1, 2009 for some reason thats not working...ive tried all combos of it using the now() function but it doesn't pull up what i want...it still pulls up events that have already passed Quote Link to comment https://forums.phpfreaks.com/topic/143386-2-questions/#findComment-752190 Share on other sites More sharing options...
dadamssg Posted February 1, 2009 Author Share Posted February 1, 2009 SELECT * FROM test WHERE DATE(start) >=NOW() AND DATE(end) <= CURDATE() ORDER BY start ASC thats what i came up with but its pulling up zero rows Quote Link to comment https://forums.phpfreaks.com/topic/143386-2-questions/#findComment-752201 Share on other sites More sharing options...
dadamssg Posted February 2, 2009 Author Share Posted February 2, 2009 anyone?....please? Quote Link to comment https://forums.phpfreaks.com/topic/143386-2-questions/#findComment-752283 Share on other sites More sharing options...
fenway Posted February 3, 2009 Share Posted February 3, 2009 Let's see some sample data. Quote Link to comment https://forums.phpfreaks.com/topic/143386-2-questions/#findComment-753344 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.