newbie-color coding a calendar?
| From: | Cory Bantic | Date: | Mon, 24 Jul 2000 15:25:59 +0000 |
| Subject: | newbie-color coding a calendar? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-7875@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:
$result = mysql("cal","SELECT Event_ID from Events WHERE Month='$month'
AND Day='$day' and Year='$year' ");
while($row = mysql_fetch_row($result)) {
$EID = $row[0];
}
$result = mysql("cal","SELECT New_ID from Pending WHERE Month='$month'
AND
Day='$day' and Year='$year' ");
while($row = mysql_fetch_row($result)) {
$NID = $row[0];
}
if (!$EID && $NID >=1){
echo "<td width='100' bgcolor= 'yellow'
valign='top'><font
color='Red'>$day</font><br>\n";
$result = mysql("cal","SELECT New_ID,ClientName from Pending WHERE
Month='$month' AND Day='$day' and Year='$year' ");
while($row = mysql_fetch_row($result)) {
$NID = $row[0];
$CLN = $row[1];
echo "<a href=\"clientView2.phtml?New_ID=$NID\"
onClick=return(openSmallWindow('clientView2.phtml?New_ID=$NID'))>$CLN</a><br
>";
$NID="";
$CLN="";
}
}
else if ($EID>=1){
echo "<td width='100' bgcolor='#CCCCCC'
valign='top'><font
color='Red'>$day</font><br>\n";
$result = mysql("elisaclark","SELECT Client_ID,ClientName from Clients
WHERE Month='$month' AND Day='$day' and Year='$year' ");
while($row = mysql_fetch_row($result)) {
$CID = $row[0];
$CLN = $row[1];
echo "<a href=\"clientView.phtml?Client_ID=$CID\"
onClick=return(openSmallWindow('clientView.phtml?Client_ID=$CID'))>$CLN</a><
br>";
$CID="";
$CLN="";
}
}
else {
echo "<td width='100' valign='top'><font
color='Red'>$day</font><br>\n";
}
echo "</td>";
The problem being that this works fine unless I have a scheduled event that
falls at the beginning of the month, and then all of the following cells are
colored gray as well. I wish I understood why. Can anyone out there help?
thanks! Cory