jspe377522
MIS
Hi guys,
I wonder if someone can help me with this, I am fairly new to php and would like to include some javascript.
I have a php events calendar which links to a mysql events table. On a day when an event is listed the colour changes. I would like to include a popup that shows details of the event(s) on the day. I came across overlib which works but i cant get the popup to show the event details. PLEASE HELP!![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Overlib is available from
I will include the code here if it helps:
** Defining the recordset at the top of the page **
mysql_select_db($database_connection, $connection);
$query_rsArticleDates = "SELECT date_format(date, '%Y-%c-%e') as
ArticleDate FROM tblEvents";
$rsArticleDates = mysql_query($query_rsArticleDates, $connection) or
die(mysql_error());
$row_rsArticleDates = mysql_fetch_assoc($rsArticleDates);
$totalRows_rsArticleDates = mysql_num_rows($rsArticleDates);
** The calendar function **
<?php
function build_calendar($month,$year,$day) {
/* Declaring the variables */
$daysOfWeek = array('S','M','T','W','T','F','S');
$firstDayOfMonth = mktime(0,0,0,$month,1,$year);
$noDays = date('t',$firstDayOfMonth);
$dateComponents = getdate($firstDayOfMonth);
$dayOfWeek = $dateComponents['wday'];
$monthName = date('F',mktime(0,0,0,$month,1,$year));
global $rsArticleDates;
global $_GET;
if (mysql_num_rows($rsArticleDates) > 0){
mysql_data_seek($rsArticleDates,0);
while($row_rsArticleDates = mysql_fetch_assoc($rsArticleDates)){
$dates[] = $row_rsArticleDates['ArticleDate'];
}
}
/* Computing the previous month. */
if($month == 1) {
$mn=12;
$yn=$year-1;
} else {
$mn=$month-1;
$yn=$year;
}
/* Computing the next month. */
if($month == 12) {
$mn2=1;
$yn2=$year+1;
} else {
$mn2=$month+1;
$yn2=$year;
}
/* Calendar header: next and previous month links */
$calendar = "<table class=caltable cellSpacing=0 cellPadding=0
border=0>";
/* $calendar .= "<tr class=calheader><td></td>";*/
$calendar .="<tr><td colspan=7 align=center
class=calheader>$monthName $year</td></tr>";
/* $calendar .="<td></td></tr>"; */
$calendar .="<tr>";
/* Calendar header: Display the days of the week */
foreach($daysOfWeek as $day) {
$calendar .= "<td align=center class=caldays>$day</td>";
}
$calendar .= "</tr>";
$calendar .= "<tr>";
$currentDay = 1;
/* Fill in the beginning of the calendar body */
if ($dayOfWeek > 0) {
$calendar .= "<td colspan='$dayOfWeek' align=center
class=calnodate> </td>";
}
/* Generate the calendar body */
while ($currentDay <= $noDays) {
if ($dayOfWeek == 7) {
$dayOfWeek = 0;
$calendar .= "</tr><tr>";
}
$date = $year."-".$month."-".$currentDay;
if (in_array($date,$dates)) {
$calendar .= "<td class=caldateon align=center><a
href=\"javascript:void(0);\" onMouseOver=\"return overlib('I WANT TO
LINK TO THE MYSQL DATABASE HERE')\" onMouseOut=\"return
nd();\">$currentDay</a></td>";
} else {
$calendar .= "<td align=center class=caldate>$currentDay</td>";
}
$currentDay++;
$dayOfWeek++;
}
/* Filling in the end of the calendar body */
if ($dayOfWeek != 7) {
$remainingDays = 7 - $dayOfWeek;
$calendar .= "<td colspan='$remainingDays' align=center
class=calnodate> </td>";
}
$calendar .= "</table>";
return $calendar;
}
if (isset($_GET['m']) && isset($_GET['y']) && isset($_GET['d'])){
$month = $_GET['m'];
$year = $_GET['y'];
$day = $_GET['d'];
} else {
$dateComponents = getdate();
$month = $dateComponents['mon'];
$year = $dateComponents['year'];
$day = $dateComponents['mday'];
}
echo build_calendar($month,$year,$day);
?>
I wonder if someone can help me with this, I am fairly new to php and would like to include some javascript.
I have a php events calendar which links to a mysql events table. On a day when an event is listed the colour changes. I would like to include a popup that shows details of the event(s) on the day. I came across overlib which works but i cant get the popup to show the event details. PLEASE HELP!
Overlib is available from
I will include the code here if it helps:
** Defining the recordset at the top of the page **
mysql_select_db($database_connection, $connection);
$query_rsArticleDates = "SELECT date_format(date, '%Y-%c-%e') as
ArticleDate FROM tblEvents";
$rsArticleDates = mysql_query($query_rsArticleDates, $connection) or
die(mysql_error());
$row_rsArticleDates = mysql_fetch_assoc($rsArticleDates);
$totalRows_rsArticleDates = mysql_num_rows($rsArticleDates);
** The calendar function **
<?php
function build_calendar($month,$year,$day) {
/* Declaring the variables */
$daysOfWeek = array('S','M','T','W','T','F','S');
$firstDayOfMonth = mktime(0,0,0,$month,1,$year);
$noDays = date('t',$firstDayOfMonth);
$dateComponents = getdate($firstDayOfMonth);
$dayOfWeek = $dateComponents['wday'];
$monthName = date('F',mktime(0,0,0,$month,1,$year));
global $rsArticleDates;
global $_GET;
if (mysql_num_rows($rsArticleDates) > 0){
mysql_data_seek($rsArticleDates,0);
while($row_rsArticleDates = mysql_fetch_assoc($rsArticleDates)){
$dates[] = $row_rsArticleDates['ArticleDate'];
}
}
/* Computing the previous month. */
if($month == 1) {
$mn=12;
$yn=$year-1;
} else {
$mn=$month-1;
$yn=$year;
}
/* Computing the next month. */
if($month == 12) {
$mn2=1;
$yn2=$year+1;
} else {
$mn2=$month+1;
$yn2=$year;
}
/* Calendar header: next and previous month links */
$calendar = "<table class=caltable cellSpacing=0 cellPadding=0
border=0>";
/* $calendar .= "<tr class=calheader><td></td>";*/
$calendar .="<tr><td colspan=7 align=center
class=calheader>$monthName $year</td></tr>";
/* $calendar .="<td></td></tr>"; */
$calendar .="<tr>";
/* Calendar header: Display the days of the week */
foreach($daysOfWeek as $day) {
$calendar .= "<td align=center class=caldays>$day</td>";
}
$calendar .= "</tr>";
$calendar .= "<tr>";
$currentDay = 1;
/* Fill in the beginning of the calendar body */
if ($dayOfWeek > 0) {
$calendar .= "<td colspan='$dayOfWeek' align=center
class=calnodate> </td>";
}
/* Generate the calendar body */
while ($currentDay <= $noDays) {
if ($dayOfWeek == 7) {
$dayOfWeek = 0;
$calendar .= "</tr><tr>";
}
$date = $year."-".$month."-".$currentDay;
if (in_array($date,$dates)) {
$calendar .= "<td class=caldateon align=center><a
href=\"javascript:void(0);\" onMouseOver=\"return overlib('I WANT TO
LINK TO THE MYSQL DATABASE HERE')\" onMouseOut=\"return
nd();\">$currentDay</a></td>";
} else {
$calendar .= "<td align=center class=caldate>$currentDay</td>";
}
$currentDay++;
$dayOfWeek++;
}
/* Filling in the end of the calendar body */
if ($dayOfWeek != 7) {
$remainingDays = 7 - $dayOfWeek;
$calendar .= "<td colspan='$remainingDays' align=center
class=calnodate> </td>";
}
$calendar .= "</table>";
return $calendar;
}
if (isset($_GET['m']) && isset($_GET['y']) && isset($_GET['d'])){
$month = $_GET['m'];
$year = $_GET['y'];
$day = $_GET['d'];
} else {
$dateComponents = getdate();
$month = $dateComponents['mon'];
$year = $dateComponents['year'];
$day = $dateComponents['mday'];
}
echo build_calendar($month,$year,$day);
?>