Jump to content

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


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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.