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 Link to comment https://forums.phpfreaks.com/topic/115021-solved-why-isnt-this-working-omg/ 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. Link to comment https://forums.phpfreaks.com/topic/115021-solved-why-isnt-this-working-omg/#findComment-591485 Share on other sites More sharing options...
spiceydog Posted July 16, 2008 Author Share Posted July 16, 2008 thank you!!!! Link to comment https://forums.phpfreaks.com/topic/115021-solved-why-isnt-this-working-omg/#findComment-591489 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. Link to comment https://forums.phpfreaks.com/topic/115021-solved-why-isnt-this-working-omg/#findComment-591772 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.