Perhaps simply store a standard English date as the index for a single
table (ie. 032902 or 03/29/02) along with a `time` and `comments` field.
Use PHP's extensive library of built-in date/time functions to translate
the date to timestamp and vice versa.

CREATE TABLE `test_calendar` (`dates` INT(6) NOT NULL, `time` INT(14)
NOT NULL, `comments` TINYTEXT NOT NULL , INDEX (`dates`)) 

Then reference the times corresponding to that date with the query

SELECT * FROM calendar WHERE dates = 032902

You can add as many times/comments to any one date that you like and
then view them all or just one at a time.  You end up with some
duplicate data in the table but it's no biggie.  I wouldn't get too
complex because I don't see the need for multiple data sets in your


-----Original Message-----
From: David Johansen [mailto:[EMAIL PROTECTED]] 
Sent: Friday, March 29, 2002 1:44 PM
Subject: [PHP] A Calendar type thingy

Ok, I'm still kind of new to this and I just have a question on how I
go about implementing something. I need to make a calendar type thing
different times in each day and store some values for each time in a
database. I was just wondering what would be the best way to do this.
what my data type would look like in C:

struct time
    char name[50];
    int avail;
    int max;

struct day
     char date[15];
     time time_values[6];

day myDates[14];

So I would have a structure for each day and that structure would hold
date and 6 times. Each time would have it's name, available spots and
maximum spots. What would be the best way to set this up in PHP and
store it
in a mySQL database. Thanks,

PHP General Mailing List (
To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to