I'm a bit stumped.
I have a SQL insert statement which is as follows:
INSERT INTO region_points (suburb_id, lat, long) VALUES ('1','-33.8737357','150.8697605')
I don't see anything at all wrong with the statement, but when i run it, I'm getting:
#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 'long) VALUES ('1','-33.8737357','150.8697605')' at line 1
Any help with this would be greatly appreciated.
Cheers
LONG
is a mysql reserved word. If an identifier contains special characters or is a reserved word, you must quote it whenever you refer to it.
And identifier quotes are backticks.
INSERT INTO region_points (suburb_id, lat, `long`) VALUES ('1','-33.8737357','150.8697605')
Ref: http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html
Just try your query like this
INSERT INTO region_points (`suburb_id`, `lat`, `long`) VALUES ('1','-33.8737357','150.8697605')
It will work.
But it is better to have your field name as "longitude" or something other than "long".
Long is a reserved key word in MySQL. Use it like 'long'
INSERT INTO region_points (`suburb_id`, `lat`, `long`)
VALUES ('1','-33.8737357','150.8697605');
long
is a reserved keyword, use like `long`
it will work.