I have the following query:
INSERT INTO user ('username', 'password', 'email', number)
VALUES ('user123', '123', 'email123@hotmail.com', 2)
and I get the error:
#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 ''username', 'password', 'email', space) VALUES('user123', '123', 'email123@hotmail.com', 2)
There is also an auto increment field (mediumint), which obviously is not mentioned in the sql statement. Could it be it?
Please help me solve this.
Use backticks (to the left of the "1" key) instead of quotes there:
INSERT INTO user (`username`, `password`, `email`, `number`)
VALUES ('user123', '123', 'email123@hotmail.com', 2)
Write quote in column name
INSERT INTO user ('username', 'password', 'email', 'number')
VALUES ('user123', '123', 'email123@hotmail.com', 2)