Hi there!
I have now managed to make a calendar, and made it possible to add events, but I have one small prolem:
I want to show who has added events on a particular day with color, each user has his own color. The way I have it now it looks like this:
function that switches the $col variable depending on the author of the event.
a while loop that renders the cal {
in that while loop, just before the table cell with the date currently being output i have made an SQL-query that grabs the days events. and after that query I run the function
}
is this a proper way to do this?
I thought that it would be a smart way to do it, but it doesn't seem to work
the code:
// Change Variable values to colors
function changeCol() {
switch($r) {
case "Admin": $col="\#FF0000"; break;
case "Snor": $col="\#FF0000"; break;
}
}
while(checkdate($month , $i - $_firstday , $today['year'])) {
if(( $i - 1) % 7 == 0) {
echo "</tr>\n<tr>\n";
}
$b = $i - $_firstday;
if($i == $today2) {
$r=mysql_fetch_array(mysql_query("SELECT * FROM cal WHERE b LIKE '$b'"));
changeCol();
echo "<td class=\"today\" onmouseover=\"this.style.backgroundColor='#ffffff' ;\" onmouseout=\"this.style.backgroundColor='#666666'; \"><a href=\"viewEvents1.php?day=$b&month=$today[month]\" target=\"calSmall\">$b</a><font color=\"$col\">$r[who]</font></td>";
}
and some more, but I don't think that is needed to show^^
I think you understand how I mean at least