Sonya Posted May 13, 2007 Share Posted May 13, 2007 I've been getting this error since around 1:30 A.M. this morning: Parse error: syntax error, unexpected '}' in /home/sitename/public_html/messages.php on line 92 and the PHP Code is this Exactly: <?php @session_start(); include("config.php"); require_once("functions.php"); // include the functions we just wrote define('DATE_FORMAT', 'Y-m-d g:ia'); // define our date format variable $myuser = $_SESSION['username']; if($myuser == "" || empty($myuser)) { echo "<div id=\"header\"></div><div id=\"center\"></div><div id=\"left\">$left</div><div id=\"details\"><a href=login.php>Login</a> or <a href=register.php>Register</a></div><div id=\"content\">Please <a href=login.php>Login</a> or <a href=register.php>Register</a> to Continue.</div>"; } else { $folder = isset($_GET['folder']) ? $_GET['folder'] : 'inbox'; switch($folder) { case 'sent': // Show my sent messages $title = "Sent Messages"; // Notice we set the second parameter to "true" to pull sent messages $myMessages = getMyMessageList('', true); // Set the columns we will be using for our display $cols = array('To', 'Subject', 'Time'); break; default: // Show our inbox // Notice we are setting the same variables as above $title = "Inbox"; $folder = "inbox"; // This is in case we have something errant entered $myMessages = getMyMessageList(); $cols = array('From', 'Subject', 'Time', 'Del'); } // This is so we know how many columns we actually have $span = count($cols); if (isset($_GET['action']) && $_GET['action'] == 'send') { $title = "Send Message"; require('new.php'); exit(); } if (isset($_GET['id'])) { $id = $_GET['id']; switch($folder) { case 'sent': $msg = getMyMessage($id, '', true); $back = "?folder=sent"; // Set my link back to Sent Messages $from = "To"; break; case 'inbox': $msg = getMyMessage($id); $back = "?folder=inbox"; $from = "From"; break; // Obviously, if you choose, you can easily add more boxes without // too much difficulty. } } // Output a "back" link echo "<div id=\"header\"></div><div id=\"center\"></div><div id=\"left\">$left</div><div id=\"details\">$myuser</div><div id=\"content\"><a href=\"$back\"> Back</a>\n"; // If there is no message returned, we have an error if (!$msg) { echo "<div id=\"content\"><p>Invalid message requested</p>\n</div>"; } else { } ?> <?php // Define our variables (removing slashes) // Add any other formating you like here (including BBCode, etc) $user = stripslashes($msg['username']); $date = date(DATE_FORMAT, strtotime($msg['time_sent'])); // Notice our defined constant $subject = stripslashes($msg['subject']); $message = nl2br(stripslashes($msg['message'])); $opened = $msg['opened']; // Mark a received message "read" when it's opened if ($msg['to_id'] == $_SESSION['userID'] && $opened == 'n') { $sql = "UPDATE myPMs SET opened = 'y', time_opened = NOW() WHERE id = '$id'"; mysql_query($sql); } // Output our message echo "<h3>$subject</h3>\n"; echo "<p>$from <b>$user</b><br />on $date</p>\n"; echo "<p>$message</p>\n"; } else { // They haven't chosen a message, so show the box! ?> <?php echo "<p><a href=\"?folder=inbox\">Inbox</a> |\n"; echo "<a href=\"?folder=sent\">Sent Messages</a></p>\n"; // If we're in the inbox, show a Create link if ($folder == 'inbox') { echo "<p><a href=\"?action=send\">Create New Message</a></p>\n"; } ?> <?php } ?> Any Help is [move]GREATLY[/move] appreciated! Please and Thank You. ^^ -Sonya Benedict =^) Quote Link to comment https://forums.phpfreaks.com/topic/51212-unfixable-php-error-xx-please-help-and-thank-you/ Share on other sites More sharing options...
paul2463 Posted May 13, 2007 Share Posted May 13, 2007 Hi Sonya to save counting lines can you point out which line is 92 ??? Quote Link to comment https://forums.phpfreaks.com/topic/51212-unfixable-php-error-xx-please-help-and-thank-you/#findComment-252174 Share on other sites More sharing options...
chigley Posted May 13, 2007 Share Posted May 13, 2007 90. } else { // They haven't chosen a message, so show the box! 91. 92. ?> 93. <?php Quote Link to comment https://forums.phpfreaks.com/topic/51212-unfixable-php-error-xx-please-help-and-thank-you/#findComment-252176 Share on other sites More sharing options...
Sonya Posted May 13, 2007 Author Share Posted May 13, 2007 Ah, okies. ^^ Sprry about that, and Yus. =P } else { // They haven't chosen a message, so show the box! Quote Link to comment https://forums.phpfreaks.com/topic/51212-unfixable-php-error-xx-please-help-and-thank-you/#findComment-252177 Share on other sites More sharing options...
esukf Posted May 13, 2007 Share Posted May 13, 2007 You have an if...else...else...statement which isn't valid. <?php if(){ //.......... } else { //......... } else { //.......... } ?> Quote Link to comment https://forums.phpfreaks.com/topic/51212-unfixable-php-error-xx-please-help-and-thank-you/#findComment-252181 Share on other sites More sharing options...
Sonya Posted May 13, 2007 Author Share Posted May 13, 2007 Ah, okies. ^^ Thank You. Also... How do I make it so that mor first if/else Statements(s) still exist? Or do they auto matically? Quote Link to comment https://forums.phpfreaks.com/topic/51212-unfixable-php-error-xx-please-help-and-thank-you/#findComment-252188 Share on other sites More sharing options...
neel_basu Posted May 13, 2007 Share Posted May 13, 2007 Somewhare you have made some wrong with '}'(s) like { { //{ } } } ------------------------------------------------- Your code is not in a Tree Structure thats why its hard to debug it Manually Please make a Tree Structure e.g. if([condition]) { //Job to do } else { //Job To Do } Quote Link to comment https://forums.phpfreaks.com/topic/51212-unfixable-php-error-xx-please-help-and-thank-you/#findComment-252200 Share on other sites More sharing options...
Barand Posted May 13, 2007 Share Posted May 13, 2007 <?php // Mark a received message "read" when it's opened if ($msg['to_id'] == $_SESSION['userID'] && $opened == 'n') { $sql = "UPDATE myPMs SET opened = 'y', time_opened = NOW() WHERE id = '$id'"; mysql_query($sql); } // line 90 - I'd guess this } shouldn't be here // Output our message echo "<h3>$subject</h3>\n"; echo "<p>$from <b>$user</b><br />on $date</p>\n"; echo "<p>$message</p>\n"; } else { // They haven't chosen a message, so show the box! Quote Link to comment https://forums.phpfreaks.com/topic/51212-unfixable-php-error-xx-please-help-and-thank-you/#findComment-252217 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.