spiceydog Posted July 16, 2008 Share Posted July 16, 2008 I am getting this error: 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 'to, date, from, subject) VALUES ('balls', 'p33n0r', '07/16/08', 'balls', 'balls'' at line 1 This is the script I'm using that it's obviously referring 2: $query = "INSERT INTO messages (message, to, date, from, subject) VALUES ('$message', '$to', '$date', '$username', '$subject')"; mysql_query($query) or die(mysql_error()); I have not slept in over 36 hours now... give me some slack.... lol Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 16, 2008 Share Posted July 16, 2008 http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html to and from are both MySQL reserved words. Avoid using reserved words as field names or table names. Although you can use `backticks` around reserved words, I'd strongly recommend changing your field names. Quote Link to comment Share on other sites More sharing options...
spiceydog Posted July 16, 2008 Author Share Posted July 16, 2008 thank you!!!! Quote Link to comment Share on other sites More sharing options...
fenway Posted July 16, 2008 Share Posted July 16, 2008 As is DATE, but apparently, it's context-sensitive reserved. 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.