Jump to content

PHP / MySQL for Recursive Calendar Appointments


kool_samule

Recommended Posts

Hi Chaps,

 

Apologies if this topic should be in MySQL...I wasn't sure.

 

I'm trying to create a MS Outlook-style Appointment application with Recurrence for a PHP calendar.

 

I've got all the same options that Outlook gives, e.g.:

 

Daily - every DAY, or every WEEKDAY

Weekly every X WEEK(S) on X DAYS

Monthly - on DAY of every X month or Nth DAY of every X MONTH(s)

Yearly - recur every X YEAR(S) on DAY of MONTH or Nth DAY of every X MONTH(s)

 

My question is what is the best way to store the recursive appointment information in MySQL Database (Columns, etc), so I can then use a PHP algorithm to calculate whether an appointment is within a calendar view, or if reminders need to be sent.

 

Any advice will be a great help.

Link to comment
Share on other sites

Are you having a start/end date for this recursion? I'd have 3 extra columns.

 

recursion_start (datetime) - this would store the first occurrence of the recurring event. this should be used to calculate what time/day of month/day of week/etc the future events will take place.

 

recursion_end (datetime) - possibly optional, if optional, then you'll have to keep this in mind when querying for a given period... WHERE recursion_end IS NULL OR recursion_end >= $calendar_starting_date

 

recursion_type (varchar) - this would hold information about how you want the recursion to be performed. You have to write a function that parses this information, and decides which dates to create this event on.

 

You'll have to calculate recursive events separately form single events, but overall it should be pretty simple to implement

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.