I am getting this message when I run my code: "error: Warning: mktime() expects parameter 6 to be long,
string given in C:\wamp\www\Project 3\SimpleCalendar\bar.php on line 6"
I am using WAMP, and this is a project assignment for school.
Can you tell me what is wrong with my code?
<?php
if(isset($GET['date']) == TRUE) {
$explodeddate = explode("-", $GET['date']);
$month = $explodeddate[0];
$year = $explodeddate[1];
$numdays = date("t", mktime(0, 0, 0, $month, 1, $year)); // this is line 6
}
else {
$month = date("n", mktime());
$numdays = date("t", mktime());
$year = date("Y", mktime());
}
$displaydate = date("F Y", mktime(0, 0, 0, $month, 1, $year));
if($month == 1) {
$prevdate = "12-" . ($year-1);
}
else {
$prevdate = ($month-1) . "-" . $year;
}
if($month == 12) {
$nextdate = "1-" . ($year+1);
}
else {
$nextdate = ($month+1) . "-" . $year;
}
// Display the date:
echo "<span class='datepicker'>";
echo "<a href='view.php?date=" . $prevdate . "'>←</a> ";
echo $displaydate;
echo " <a href='view.php?date=" . $nextdate . "'>→</a> ";
echo "</span>";
echo "<br />";
?>
<div id="eventcage">
<p>To view event information here, click on the item in the
calendar.</p>
</div>
<?php
echo "<h1>Latest Events</h1>";
echo "<ul>";
$nearsql = "SELECT * FROM events WHERE date >= NOW() ORDER BY starttime;";
$nearres = mysql_query($nearsql);
$nearnumrows = mysql_num_rows($nearres);
if($nearnumrows == 0) {
echo "No events!";
}
else {
while($nearrow = mysql_fetch_assoc($nearres)) {
echo "<li><a href='#' onclick='getEvent("
. $nearrow['id'] . ")'>" . $nearrow['name'] . "</a> (<i>"
. $nearrow['date'] . "</i>)</li>";
}
}
echo "</ul>";
?>