I have made an PHP Event calender where the user can add events..
Now i want to highlight the day where there is an event. I have already highlighted the current day like shown on te sreenshot:
http://i41.tinypic.com/t0nlti.png
</script>
<style>
.today{
background-color: #00ff00;
}
.event{
background-color: #FF8080;
}
</style>
Actual code:
$monthstring = $month;
$monthlength = strlen($monthstring);
$daystring = $i;
$daylength = strlen($daystring);
if($monthlength <= 1){
$monthstring = "0".$monthstring;
}
if($daylength <=1){
$daystring = "0".$daystring;
}
$todaysDate = date("m/d/Y");
$dateToCompare = $monthstring. '/' . $daystring. '/' . $year;
echo "<td align='center' ";
if ($todaysDate == $dateToCompare){
echo "class ='today'";
}
//here it goes wrong..
else
{
$sqlCount = "select * from eventcalendar where eventDate='".$dateToCompare."'";
$noOfEvent = mysql_num_rows(mysql_query($sqlCount));
if($noOfEvent >= 1){
echo "class='event'";
}
}
As you see the highlighting of today goes fine.
$eventsdate = $month."-".$month."-".$day;
DB layout:
http://i41.tinypic.com/2luvok4.png
Hope anyone can help me.