the subject basically sums it up, but i am working on a calendar in php for a client that should pull events from a table and display them in the appropriate cells.
the calendar table is working no prob, but what i am trying to avoid is making a separate DB call for each day of the month.
i am trying to figure out a way to store the results in an array of arrays first, then as the calendar is created, each day that has an event(s) would display some portion of the data for that even there.
it’s a conceptual problem i am having and i can’t seem to solve it.
also, not sure if it’s possible.
any help is appreciated.
thanks.
for example:
select day, title, desc where month = $month and year = $year order by day asc
and ultimately output something like this without hitting the DB 31 times:
day1.
title / desc
day2.
title / desc <br>
title / desc
day3.
title / desc
you can do one query to get all the events in this mounth,
like you write
and in the foreach loop on the results,
store it in array like
so in the end of the loop you have array $events, where every entry contain an array of the events in this day.
like
$events[1], $events[2] ....