mysql syntax..

A

Anonymous

Guest
hi ;
I am using mysql v4.0.x and cannot figure out where the mistake is in this code ....
Code:
INSERT INTO tokens_8 ('firstname','lastname','email','token') VALUES ('johny','bravo','jbravo@gmail.com', '2938047811')
gettin erro message :
#1064 - 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 ''firstname','lastname','email','token') VALUES ('Melik Emirhan'
 
Don't use symbl ' for fieldnames. Use ` or nothing at all (if name isn't specific like user, select, ...).

Code:
INSERT INTO tokens_8 (firstname,lastname,email,`token`) VALUES ('johny','bravo','jbravo@gmail.com', '2938047811')
 
What GedroX said was correct.

I suggest to always use `fieldname` and `tablename` with backticks `` just to be clear.

Coditor
 
Back
Top