Helpful Information
 
 
Category: MySQL
Calendar scheduling script w/ php and mySQL

I would like to create an online scheduling page for people to schedule meetings. Ideally this would display a calendar with the dates and times available, (which would be populated from a DB).

I don't have a problem with the scheduling after the calendar is created, the problem I cna't figure out is how to create a DB.

Right now I have a DB with a tables like such:

table months(yearID, monthID, monthName, firstDayOfMonth, totalDaysInMonth)

where firstDayOfMonth is the day of the week that the first day falls on.

for example, the query "SELECT * FROM months WHERE yearID=2002 and monthID=7" would yield:

2002, 7, July, 1, 31

Since 0=Sunday, 1=Monday and so on this tells me that July 2002 starts on a Monday and has 31 days, so from that I can construct a calendar.

Now, I know there is an easier way to construct a calendar, and I've looked for a perpetual calendar, but can't find any info on how to get the first day of the month based on any algorithm.

Does anybody have some ideas on an easier way ot accomplish this? Thanks

You should read some tutorials on data modelling then. You should first come up with an ER diagram to develop the schema for your project.

Right, the ER modeling isn't what I'm concerned about at this time. I guess I gave too much info.

What I'm really looking for is an algorithm to determing the info that I was going to store in the table outlined above.

I know there is an algorithm for determining the first day of the month in for any month in a given year, I just don't know what it is. Anybody know?


That way, rather then quering the DB to set up my calendar, I can just plug in the variable into an equation, and spit out the calender where the individual days will query the DB asking for available times.

Thanks for your help tho.

have PHP?



<?
print ("my birfday is on a " . date ("l", mktime(0,0,0,15,08,2002)));
?>


php can also calculate dates in systems other than gregorian, but I am pretty sure that MySQL can do exactly the same for you - maybe take a peek in the manual.










privacy (GDPR)