RE: [PHP] A Calendar type thingy

From: Date: Fri, 29 Mar 2002 21:39:12 +0000
Subject: RE: [PHP] A Calendar type thingy
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-90719@lists.php.net to get a copy of this message
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 string.. --------------- 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 example. -Kevin -----Original Message----- From: David Johansen [mailto:daveisfera@yahoo.com] Sent: Friday, March 29, 2002 1:44 PM To: php-general@lists.php.net Subject: [PHP] A Calendar type thingy Ok, I'm still kind of new to this and I just have a question on how I should go about implementing something. I need to make a calendar type thing with 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. Here's 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 the 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, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#90719) next »