Jump to content

[SOLVED] Why Isn't This Working!? OMG!!!!!


spiceydog

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.