David Barclay :
I'm creating a fixture list for football and would like to create a page "weekend fixtures".
I have managed the following
SELECT * FROM events WHERE DAYOFWEEK(event_time) = 7
or DAYOFWEEK(event_time) = 1
or (DATE_FORMAT(event_time, "%T") > '17:30:00' AND DAYOFWEEK(event_time) = 6)
The above code works in returning fixtures for all weekends. But I need either the current or next.
Any advice would be appreciated.
nbk :
you can use WEEK function from mysql
This would check id´f event timestamp is in this or the next week
SELECT * FROM events WHERE (DAYOFWEEK(event_time) = 7
or DAYOFWEEK(event_time) = 1
or (DATE_FORMAT(event_time, "%T") > '17:30:00' AND DAYOFWEEK(event_time) = 6))
AND ((WEEK(event_time) = WEEK(Now()) ) OR (WEEK(event_time) = WEEK(Now()) +1 ))