timmah1 Posted September 3, 2008 Share Posted September 3, 2008 I have an event calendar, and right now, I'm getting an error and i don't understand why. My error is this Parse error: syntax error, unexpected ';' in view.php on line 45 Line 45 is this $daysleft = 6 - $weekday-; My code before this is this session_start(); require("config.php"); //if(isset($_SESSION['USERNAME']) == FALSE) { // header("Location: " . $config_basedir); //} function short_event($name) { $final = ""; $final = (substr($name, 0, 12) . "..."); return $final; } require("header.php"); if($_GET['error']) { echo "<script>newEvent('" . $_GET['evendate'] . "', 1)</script>"; } $cols = 7; $weekday = date("w", mktime(0, 0, 0, $month, 1, $year)); $numrows = ceil(($numdays + $weekday) / $cols); echo "<br />"; echo "<table class='cal' cellspacing='0' cellpadding='5' border='1'>"; echo "<tr>"; echo "<th class='cal'>Sunday</th>"; echo "<th class='cal'>Monday</th>"; echo "<th class='cal'>Tuesday</th>"; echo "<th class='cal'>Wednesday</th>"; echo "<th class='cal'>Thursday</th>"; echo "<th class='cal'>Friday</th>"; echo "<th class='cal'>Saturday</th>"; echo "</tr>"; $counter = 1; $newcounter = 1; echo "<tr>"; $daysleft = 6 - $weekday-; This is not the entire code, just up to the error Can anybody help me out here? Thanks in advance Link to comment https://forums.phpfreaks.com/topic/122479-calendar-error/ Share on other sites More sharing options...
Porl123 Posted September 3, 2008 Share Posted September 3, 2008 Is there any use for that minus after the variable? Link to comment https://forums.phpfreaks.com/topic/122479-calendar-error/#findComment-632433 Share on other sites More sharing options...
Caesar Posted September 3, 2008 Share Posted September 3, 2008 $daysleft = 6 - $weekday-; Link to comment https://forums.phpfreaks.com/topic/122479-calendar-error/#findComment-632434 Share on other sites More sharing options...
timmah1 Posted September 3, 2008 Author Share Posted September 3, 2008 According to the tutorials that I have read, yes, it calculates the days left by removing $weekday- ($weekday minus 1) from 6 (the number of days in a week), because the function starts at 0 Link to comment https://forums.phpfreaks.com/topic/122479-calendar-error/#findComment-632437 Share on other sites More sharing options...
timmah1 Posted September 3, 2008 Author Share Posted September 3, 2008 I can post the entire code. Right now, the error shows up, but if I take out the - behind weekday, the calendar is throw out of whack only showing 6 days, and the rest are all labled 2 Link to comment https://forums.phpfreaks.com/topic/122479-calendar-error/#findComment-632438 Share on other sites More sharing options...
Porl123 Posted September 3, 2008 Share Posted September 3, 2008 It would be daysleft = 6 - ($weekday--); maybe the brackets are unnecessary Link to comment https://forums.phpfreaks.com/topic/122479-calendar-error/#findComment-632439 Share on other sites More sharing options...
timmah1 Posted September 3, 2008 Author Share Posted September 3, 2008 Perfect Porl123! I no longer get the error, but the calendar shows 7 rows, 5 columns. The top row for this month is as follows Sunday Monday Tuesday Wednesday Thursday Friday Saturday 1 2 3 4 5 6 But, for every row after that, the days are labled 02, any idea why that would be? Link to comment https://forums.phpfreaks.com/topic/122479-calendar-error/#findComment-632440 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.