Styles2304 Posted August 24, 2007 Share Posted August 24, 2007 Ok, the error: Parse error: syntax error, unexpected T_ECHO in /home/styles/public_html/calendar.php on line 67 And the code: <?php $day = $_GET["day"]; $month = $_GET["month"]; $year = $_GET["year"]; if ($day == "") $day = date("j"); if ($month == "") $month = date("n"); //11 if ($year == "") $year = date("Y"); $currentTimeStamp = strtotime("$year-$month-$day"); $monthName = date("F", $currentTimeStamp); $numDays = date("t", $currentTimeStamp); $counter = 0; //20 ?> <LINK REL=StyleSheet HREF="calendar.css" TYPE="text/css"> <table width='168' border='0' cellspacing='0' cellpadding='0'> <tr> <td colspan="7" class="title"> <font class="title"> <center> <?php echo date("F");?> </center> </font> </td> </tr> <tr class="daylabels"> <td class='head' width='24'>Sn</td> <td class='head' width='24'>Mn</td> <td class='head' width='24'>Tu</td> <td class='head' width='24'>Wd</td> <td class='head' width='24'>Th</td> <td class='head' width='24'>Fr</td> <td class='head' width='24'>St</td> </tr> <tr class="date"> <?php //48 for ($i = 1; $i < $numDays + 1; $i++, $counter++) { $timeStamp = strtotime("$year-$month-$i"); if ($i == 1) { //Figures out when the first day of the month is $firstDay = date("w",$timeStamp); for($j = 0; $j < $firstDay; $j ++, $counter++) echo "<td> </td>"; } //59 if($counter % 7 == 0) echo "</tr><tr class='date'>"; if (date("w", $timeStamp) == 0 || date("w", $timeStamp) == 6) echo "<td width='24' class='weekend'>$i</td>"; if (date($i == date("d") && $month == date("m") && $year == date("Y")) echo "<td width='24' class='today'>$i</td>"; echo "<td width='24'>$i</td>"; } ?> </table> Line 67 is the 2nd to last echo statement where class='today' . . . can anyone see what the problem is? Or is the error elsewhere? For that matter . . . does anyone know a good tutorial for creating a calendar in PHP? Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 24, 2007 Share Posted August 24, 2007 if (date($i == date("d") && $month == date("m") && $year == date("Y")) if (date($i == date("d")) && $month == date("m") && $year == date("Y")) Missing a ). PS: You really should use {} in your conditional statements, what if you need to add another line in there and you forget to add them? Then you have to hunt down an error you're unsure about. It's good practice to add them by default. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.