Question : Time Calculation/Interval

I am running a mysql query in order to get specific events from my database for the upcoming 7 days however it does not show today's event and it does always start with tomorrow events for 7 days.

I am not sure what I am doing wrong from the logic because I am using NOW(). Any ideas to help me here. Thank you very much.

Again, I need to show any event from right now up to 7 days. thanks
1:
SELECT *, DAYOFMONTH(CONCAT_WS('-', `year`, `month`, `day`)) AS monthDay FROM `calendarix_events` WHERE UNIX_TIMESTAMP(CONCAT_WS('-', `year`, `month`, `day`)) BETWEEN UNIX_TIMESTAMP(NOW()) AND UNIX_TIMESTAMP(DATE_ADD(NOW(), INTERVAL 14 DAY)) AND cat != 6 ORDER BY `year` ASC, `month` ASC, `day` ASC, `starttime` ASC

Answer : Time Calculation/Interval

Query 5 is your query, just without the ORDER BY part. If query 5 gives you the records for today, then your query must work. Ordering won't remove any records from the results.

Run your query again :
SELECT *, DAYOFMONTH(CONCAT_WS('-', `year`, `month`, `day`)) AS monthDay FROM `calendarix_events` WHERE UNIX_TIMESTAMP(CONCAT_WS('-', `year`, `month`, `day`)) BETWEEN UNIX_TIMESTAMP(CURDATE()) AND UNIX_TIMESTAMP(DATE_ADD(CURDATE(), INTERVAL 14 DAY)) AND cat != 6 ORDER BY `year` ASC, `month` ASC, `day` ASC, `starttime` ASC

If you don't see today's records then please make absolutely sure they are not hiding somewhere in the results. If you are sure they are not there, then just remove the ORDER BY part from the query and run it again. If the records suddenly show up, then it sounds like some kind of bug to me and I would recommend upgrading your MySQL server to make sure. It works on my version 5.0.51a server and version 5.1.11 client.
Random Solutions  
 
programming4us programming4us