Ik heb voor het goede doel een website gemaakt met een kalender. Nu heb ik op de website alle activiteiten i nde kalender gezet. (Deze worden uit de mysql databse ingeladen). Maar alle evenementen uit 2016 werken niet en alles uit 2015 wordt netjes weergegeven. Kan iemand mij helpen?
De website met de kalender is:
http://wskrimpenerwaard.nl/acties.php
De codes:
Spoiler
<?php
error_reporting(0);
include("./config.php");
/// get current month and year and store them in $cMonth and $cYear variables
(intval($_REQUEST["month"])>0) ? $cMonth = intval($_REQUEST["month"]) : $cMonth = date("m");
(intval($_REQUEST["year"])>0) ? $cYear = intval($_REQUEST["year"]) : $cYear = date("Y");
// generate an array with all dates with events
$sql = "SELECT * FROM ".$SETTINGS["data_table"]." WHERE `event_date` LIKE '".$cYear."-".$maand1."-%'";
$sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql);
while ($row = mysql_fetch_assoc($sql_result)) {
$events[$row["event_date"]]["title"] = $row["title"];
$events[$row["event_date"]]["description"] = $row["description"];
}
// calculate next and prev month and year used for next / prev month navigation links and store them in respective variables
$prev_year = $cYear;
$next_year = $cYear;
$prev_month = intval($cMonth)-1;
$next_month = intval($cMonth)+1;
// if current month is December or January month navigation links have to be updated to point to next / prev years
if ($cMonth == 12 ) {
$next_month = 1;
$next_year = $cYear + 1;
} elseif ($cMonth == 1 ) {
$prev_month = 12;
$prev_year = $cYear - 1;
}
if ($prev_month<10) $prev_month = '0'.$prev_month;
if ($next_month<10) $next_month = '0'.$next_month;
if ($cMonth == 1) { $maand = "Januari";}
if ($cMonth == 2) { $maand = "Februari";}
if ($cMonth == 3) { $maand = "Maart";}
if ($cMonth == 4) { $maand = "April";}
if ($cMonth == 5) { $maand = "Mei";}
if ($cMonth == 6) { $maand = "Juni";}
if ($cMonth == 7) { $maand = "Juli";}
if ($cMonth == 8) { $maand = "Augustus";}
if ($cMonth == 9) { $maand = "September";}
if ($cMonth == 10) { $maand = "Oktober";}
if ($cMonth == 11) { $maand = "November";}
if ($cMonth == 12) { $maand = "December";}
?>
<table width="100%">
<tr>
<td class="mNav"><a href="javascript:LoadMonth('<?php echo $prev_month; ?>', '<?php echo $prev_year; ?>')"><img src="/img/design/pijllinks1.png"></a> </td>
<td colspan="5" class="cMonth"><?php echo $maand . ", " . $cYear; ?></td>
<td class="mNav"><a href="javascript:LoadMonth('<?php echo $next_month; ?>', '<?php echo $next_year; ?>')"><img src="/img/design/pijlrechts1.png"></a></td>
</tr>
<tr>
<td class="wDays">Ma.</td>
<td class="wDays">Di.</td>
<td class="wDays">Wo.</td>
<td class="wDays">Do.</td>
<td class="wDays">Vr.</td>
<td class="wDays">Za.</td>
<td class="wDays">Zo.</td>
</tr>
<?php
$first_day_timestamp = mktime(0,0,0,$cMonth,1,$cYear); // time stamp for first day of the month used to calculate
$maxday = date("t",$first_day_timestamp); // number of days in current month
$thismonth = getdate($first_day_timestamp); // find out which day of the week the first date of the month is
$startday = $thismonth['wday'] - 1; // 0 is for Sunday and as we want week to start on Mon we subtract 1
for ($i=0; $i<($maxday+$startday); $i++) {
if (($i % 7) == 0 ) echo "<tr>";
if ($i < $startday) { echo "<td> </td>"; continue; };
$current_day = $i - $startday + 1;
if ($current_day<10) $current_day = '0'.$current_day;
// set css class name based on number of events for that day
if ($events[$cYear."-".$cMonth."-".$current_day]<>'') {
$css='withevent';
$click = "onclick=\"LoadEvents('".$cYear."-".$cMonth."-".$current_day."')\"";
} else {
$css='noevent';
$click = '';
}
echo "<td class='".$css."'".$click.">". $current_day . "</td>";
if (($i % 7) == 6 ) echo "</tr>";
}
?>
</table>
Groetjes,
Dennis