Page 1 of 1

Problem with the word ADD

Posted: Mon Nov 30, 2009 7:38 am
by smartrah
I am having trouble creating a table with the name 'ADD' as a user submits this word in a php form. Any other user entry into the form works fine in creating a table.

Here is the error line "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 'add (Name VARCHAR(30), Day INT(3), Month VARCHAR(15), Year INT(5), Shift VARCHAR' at line 1"

Why only this error with the word 'ADD'


Help Please!

Re: Problem with the word ADD

Posted: Mon Nov 30, 2009 9:20 am
by jackpf
Try using backticks (`) around the table name. Add is probably a reserved word.

Re: Problem with the word ADD

Posted: Mon Nov 30, 2009 9:42 am
by AbraCadaver
ADD is a reserved word. You'll need to quote it to use it.

-Shawn

Re: Problem with the word ADD

Posted: Mon Nov 30, 2009 9:49 am
by jackpf
Yeah, cause that isn't exactly what I just said -_-

Re: Problem with the word ADD

Posted: Mon Nov 30, 2009 10:33 am
by AbraCadaver
Doh! I had this window open, went out for a smoke, came back and answered it.

Re: Problem with the word ADD

Posted: Mon Nov 30, 2009 12:57 pm
by jackpf
haha

Ahh well, nice to know someone agrees with me ;p

...you were out for 22 mins?! Wonder what you were smoking...