glenelkins Posted November 13, 2006 Share Posted November 13, 2006 Can anyone spot where this error is coming from? You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'read='1' WHERE id='1'' at line 1[code]<?$id = $_GET['id'];$result = $this->DbQuery ("SELECT subject,message,from_id FROM messages WHERE id='$id'") or die (mysql_error());$this->DbQuery("UPDATE messages SET read='1' WHERE id='$id'") or die (mysql_error());list ($subject,$message,$from_id) = mysql_fetch_array($result);?>[/code] Quote Link to comment Share on other sites More sharing options...
Destruction Posted November 13, 2006 Share Posted November 13, 2006 Hmm could be because you're using integer values inside string quotes? Try taking the single quotes out if you know that they're numeric values.Dest Quote Link to comment Share on other sites More sharing options...
Zane Posted November 13, 2006 Share Posted November 13, 2006 read is a reserved word in MySQLyou can either change the column name to something else...orin your query surround the word read with backticks (to the left of the ONE key)`read` Quote Link to comment Share on other sites More sharing options...
Destruction Posted November 13, 2006 Share Posted November 13, 2006 Ah thanks Zanus I wasn't sure if that'd be a reserved word...I tend to use ` around all my field names in the first place so don't come across them too often :) 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.