howdy ya,
i made myself a event calendar which works great except for one minor detail which i would like to fix. which is if 1 date lets say today's date 09/10/2011 has 3 events on it it only shows the most recent one posted.. i want it to post all 3 events..
here is what it looks like right now
here is what i want it to kinda look like
here is the script
the problem is at line 116 -118
which is these lines here
can someone please help me
Thank you
Sparchy
i made myself a event calendar which works great except for one minor detail which i would like to fix. which is if 1 date lets say today's date 09/10/2011 has 3 events on it it only shows the most recent one posted.. i want it to post all 3 events..
here is what it looks like right now
here is what i want it to kinda look like
here is the script
PHP Code:
<html>
<head>
<style type="text/css">
a.info{
position:relative; /*this is the key*/
z-index:24;
color:#FFFFFF;
text-decoration:none}
a.info:hover{z-index:25;
}
a.info span{display: none}
a.info:hover span{ /*the span will display just on :hover state*/
display:block;
position:absolute;
padding: 9px;
border:1px solid #FFFFFF;
background-color:#424242;
color:#FFFFFF;
font-size: 10px;
filter: progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=145);
text-align: center}
</style>
</head>
<?php
$monthNames = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$weekNames = Array("S", "M", "T", "W", "T", "F", "S");
if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n");
if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y");
$cMonth = $_REQUEST["month"];
$cYear = $_REQUEST["year"];
$prev_year = $cYear;
$next_year = $cYear;
$prev_month = $cMonth-1;
$next_month = $cMonth+1;
if ($prev_month == 0 ) {
$prev_month = 12;
$prev_year = $cYear - 1;
}
if ($next_month == 13 ) {
$next_month = 1;
$next_year = $cYear + 1;
}
?>
<table width="120" bgcolor="414141" cellpadding="0" Cellspacing="0">
<tr align="center">
<td bgcolor="#414141" style="color:#FFFFFF">
</td>
</tr>
<tr>
<td align="center">
<table width="100%" height="10" border="1" cellpadding="2" cellspacing="2">
<tr align="center">
<td bgcolor="#999999" style="color:#000000"><a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $prev_month . "&year=" . $prev_year; ?>" title="Previous Month" style="color:#000000"><center><b>«</b></center></a></td>
<td colspan="5" bgcolor="#999999" style="color:#000000"><strong><?php echo $monthNames[$cMonth-1].' '.$cYear; ?></strong></td>
<td bgcolor="#999999" style="color:#000000"><a href="<?php echo $_SERVER["PHP_SELF"] . "?month=". $next_month . "&year=" . $next_year; ?>" title="Next Month" style="color:#000000"><center><b>»</b></center></a></td>
</tr>
<tr>
<?php
$i = 0;
foreach ($weekNames as $v) {
echo "<td align='center' bgcolor='#999999' style='color:#000000'><strong>$v</strong></td>";
$i++;
}
?>
</tr>
<?php
$timestamp = mktime(0,0,0,$cMonth,1,$cYear);
$maxday = date("t",$timestamp);
$thismonth = getdate ($timestamp);
$startday = $thismonth['wday'];
$today = date("j");
$currentmonth = date('n');
$currentyear = date("Y");
for ($i=0; $i<($maxday+$startday); $i++) {
if($cMonth < 10){
$month_formated = "0$cMonth";
}else{
$month_formated = $cMonth;
}
if(($i - $startday + 1) < 10){
$day_formated = "0".($i - $startday + 1)."";
}else{
$day_formated = ($i - $startday + 1);
}
$dato_formated = "$cYear-$month_formated-$day_formated";
include 'db.php';
$get_calendar_data = mysql_query("SELECT * FROM event WHERE dates='$dato_formated'");
$count_rows = mysql_num_rows($get_calendar_data);
while ($row = mysql_fetch_array($get_calendar_data)) {
$dates = $row['dates'];
$events = $row['events'];
$event_des = $row['event_des'];
$time = $row['time'];
$username = $row['username'];
$filter = $row['filter'];
}
if($count_rows > 0){
if($filter == "event"){
$bgcolor = "#0000FF";
}elseif($filter == "holiday"){
$bgcolor = "0066CC";
}
$link = "<a class='info' style='text-decoration:none;' href='#'>
<font color='#FFFFFF'><center>". ($i - $startday + 1) . "<span>".$events."<hr><br>".$event_des."<br><br>".$time."</span></center></font>
</a>";
}else{
$bgcolor = "#494949";
$link = "". ($i - $startday + 1) . "";
}
$calendar_data = mysql_fetch_assoc($get_calendar_data);
$heading = $calendar_data['heading'];
if(($i % 7) == 0 ) echo "<tr>\n";
if($i < $startday) echo "<td></td>\n";
else
if (($i - $startday + 1) == $today && $currentmonth == $cMonth && $currentyear == $cYear)
echo ("<td bgcolor='FF0000'><center><font color='FFFFFF'>".($i - $startday + 1)."</font></center></td>");
else
echo "
<td align='left' valign='top' height='20px' bgcolor='$bgcolor'><center>
$link
</center></td>\n";
if(($i % 7) == 6 ) echo "</tr>\n";
}
?>
</table>
</td>
</tr>
</table>
which is these lines here
PHP Code:
$link = "<a class='info' style='text-decoration:none;' href='#'>
<font color='#FFFFFF'><center>". ($i - $startday + 1) . "<span>".$events."<hr><br>".$event_des."<br><br>".$time."</span></center></font>
</a>";
Thank you
Sparchy
Comment