Reccuring events in calendar application

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Reccuring events in calendar application

Post by JayBird »

Im really stumped on this one.

I have built a calendar application (monthly view) where users can input appointments and the like.

This part was quite easy, but now i need to add a feature so when someone adds an appointment, they can choose whether it reccurs weekly or monthly.

I haven't got a clue how to make the appointments appear for future dates.

I don't think i can use a cron job to update all the recurring appointments because a user is able to choose a month they want to view in the future and the appointment needs to be shown there too.

I can't imagine that for each day, i need to check back to see if there were any recurring events?

Any pointers on how i would achieve this?

Thanks

Mark
User avatar
xisle
Forum Contributor
Posts: 249
Joined: Wed Jun 25, 2003 1:53 pm

Post by xisle »

You may want to create a single record for each occurrence. Flag that record with a key to the description of the recurring event.

Soo two tables
recurring table: recurring id, description
events table: event id, recurring id, date, time, etc.

that is one way to handle it..
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

what if the event that i am entering recurrs indefinately?

The way you suggested is not a bad idea if i want an event to occur monthly for the next 8 months, but not indefinately recurring.

Any other ideas how to handle this situation?

Thanks

Mark
User avatar
xisle
Forum Contributor
Posts: 249
Joined: Wed Jun 25, 2003 1:53 pm

Post by xisle »

You could have the user choose a start_date and end_date along with the frequency.
You could also have the user choose every individual date from a twelve month calendar-- I prefer this method because of flexibility around holidays, plus it looks cooler.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

xisle wrote:You could have the user choose a start_date and end_date along with the frequency.
What do you mean by frequency?

Mark
User avatar
xisle
Forum Contributor
Posts: 249
Joined: Wed Jun 25, 2003 1:53 pm

Post by xisle »

sorry, yeah the frequency ie. ( daily, weekly, monthly, every Friday )of the recurring event. This method works well but you will have to output the dates based on the frequency - which can be tricky.
Post Reply