I have events (datetime) in my MySQL database.
Days have 0, 1, or more events.
I want to show the upcoming 7 days, and below each day list the events happening that day (if any).
What would be the best practice to do so?
The easiest would be:
for(days) {
for(mysql_query_get_events) {
display_event
}
}
but it would require to run the same big query for each day, and I believe this is very ineffective. How would you proceed?
Something along:
This would select all events in the upcoming 7 days
Edit: Just grab all events, loop through the days and keep popping results off the stack. E.g: