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
[php]
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}
<?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;
}
?>
|
« |
<?php echo $monthNames[$cMonth-1].' '.$cYear; ?> |
» |
<?php
$i = 0;
foreach ($weekNames as $v) {
echo “
$v | ”;
$i++;
}
?>
<?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 == “Fire”){
$bgcolor = “#0000FF”;
}elseif($filter == “Eldon”){
$bgcolor = “0066CC”;
}
$link = "
“. ($i - $startday + 1) . “”.$events.”
".$event_des."
".$time."
";
}else{
$bgcolor = “#494949”;
$link = “”. ($i - $startday + 1) . “”;
}
$calendar_data = mysql_fetch_assoc($get_calendar_data);
$heading = $calendar_data[‘heading’];
if(($i % 7) == 0 ) echo “
\n”;
if($i < $startday) echo “ | \n”;
else
if (($i - $startday + 1) == $today && $currentmonth == $cMonth && $currentyear == $cYear)
echo ("".($i - $startday + 1)." | ");
else
echo "
$link
| \n";
if(($i % 7) == 6 ) echo " \n";
}
?>
|
[/php]
and if ya want the sql part to test it out
CREATE TABLE `event` (
`id` int(25) NOT NULL default '0',
`dates` date NOT NULL default '0000-00-00',
`events` varchar(255) collate latin1_general_ci NOT NULL default '',
`event_des` text collate latin1_general_ci NOT NULL,
`time` varchar(25) collate latin1_general_ci NOT NULL default '',
`username` varchar(255) collate latin1_general_ci NOT NULL default '',
`filter` varchar(255) collate latin1_general_ci NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
i hope someone can help me here
thank you in advanced
Sparchy