Calendar logic question
| From: | Matt Schroebel | Date: | Wed, 21 Aug 2002 17:54:49 +0000 |
| Subject: | Calendar logic question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-113506@lists.php.net to get a copy of this message | ||
I have a calendar application that shows events in a month. I want to add the ability to have
re-occuring events. I've been thinking about how to do that, but it's not seeming to be
too easy.
Say, I have a table of re-occuring events:
eventId int
eventName varchar
eventStartDate date
eventEndDate date
eventOccuranceType enum(weekly, monthly, daily)
eventInterval int
eventDOW int
Should I populate the actual events table with re-occuring events at insert/update/delete times, or
should I code the event listing page to determine if there are events that would occur in the month
shown? The first way would be costly at insert time, and may add lots of events that will never
occur -- plus one can't go on forever, so at some point, it seems, it would have to do the
second way anyway. The second way, is costly at page view time. With a small number of
re-occurring events, that probably wouldn't be an issue, but as the calendar usage grows, I can
see that becoming resource costly.
Is there a better way?