Re: newbie-color coding a calendar?

From: Date: Mon, 24 Jul 2000 17:42:26 +0000
Subject: Re: newbie-color coding a calendar?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-7936@lists.php.net to get a copy of this message
> Hi, all - I'm new to PHP (it's also my 1st attempt at programming-ugh) and > I'm trying to develop a calendar that will reflect event types with color > coded cells. I've got 2 event tables, 'Pending' and 'Events' and > where > there is an event in Pending, I want the cell color to be yellow and where > there is an event in Events, I want the cell color to be gray, and where > there is no event currently pending or scheduled, I want the cell color to > be white. I've gotten halfway there...this is what I have so far: Just a quick comment. I have not read your code very thoroughly, and don't have a solution ready for your problem, but at first glance I see a different problem you need to avoid. Since you are doing multiple SELECT statements and then using the results in a combined fashion, you need to LOCK your tables to avoid race conditions like ”some other script/thread INSERTs new data between two SELECT statements”. Use ”LOCK TABLES Pending, Events READ” and ”UNLOCK TABLES Pending, Events” to avoid this. Best regards, Jesper Juhl Juhl@eisenstein.dk

« previous php.general (#7936) next »