TeddyKiller Posted April 4, 2010 Share Posted April 4, 2010 $update = mysql_query("update `sent_messages` set `status`='read' where `to_id`='$user->id' and `id`='$id'"); if($update){ $mail = $user->unread_mail-1; $update2 = mysql_query("update `users` set unread_mail='$mail' where `id`='$user->id'"); ` } The code works if I remove the if statement, and the contents in it. Though if I have it there.. for some reason it brings up an error for line 407. Now line 407 is completely different. Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/jeanie/public_html/mail.php on line 407 echo'<div style="width:400px; float:right; padding:7px 0 7px 0;">Date: '.date('d.m.y H:i', $row['date']).'<br />To: <a href="#">'.ucwords($r['username']).'</a><br />From: <a href="#">'.ucwords($rw['username']).'</a><br />Subject: <a href="#">'.ucwords($row['subject']).'</a><br /></div>'; I dont quite understand this? Quote Link to comment Share on other sites More sharing options...
gamblor01 Posted April 4, 2010 Share Posted April 4, 2010 When these sorts of "mysterious" errors happen, it's almost always caused by some erroneous quote somewhere (or curly brace, etc.). What happens is that it causes the interpreter (or compiler -- depending on the language/case) to expect that one particular code construct has begun. It may be the case that it expects the construct to end on the next line of code, or 15 lines of code later. Who knows. Take a look at the second line in your if statement. You appear to have a random backtick at the very end of the line. There is a semicolon, then a space, and then a backtick: $update2 = mysql_query("update `users` set unread_mail='$mail' where `id`='$user->id'"); ` php is probably expecting you to close that backtick at some point in time later and that is why it complains about the seemingly unrelated line. Also, I'm not really sure why you have the backticks around users and id. I don't think they are necessary are they? You might want to change that line of code to this: $update2 = mysql_query("update users set unread_mail='$mail' where id='$user->id'"); Quote Link to comment Share on other sites More sharing options...
TeddyKiller Posted April 4, 2010 Author Share Posted April 4, 2010 Oh I didn't notice that, but that wasn't the problem unfortunately.. if($update){ $mail = $user->unread_mail-1; $update2 = mysql_query("update users set unread_mail='$mail' where id='$user->id'"); ` } Still same error. Hasn't budged... EDIT: Ohhhh!!! That backtick is pretty hidden! Wow.. how in earth did I manage to put that there. 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.