Gravy
Gravy

Reputation: 12445

Debug Error in MySQL syntax please

Any ideas what I am doing wrong???

INSERT INTO LondonFixes ('id', 'Metal', 'AmPm', 'GBP', 'USD', 'EUR', 'Updated')VALUES(NULL, 'Gold', 'AM', '1055.91', '1646.00', '1272.03', '2012-06-19')

gives the following 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 ''id', 'Metal', 'AmPm', 'GBP', 'USD', 'EUR', 'Updated')VALUES(NULL, 'Gold', 'AM',' at line 1

Upvotes: 0

Views: 231

Answers (2)

John Woo
John Woo

Reputation: 263693

In MySQL, if you want to escape the column names, do not use single quote but instead use backtick.

INSERT INTO LondonFixes (`id`, `Metal`, `AmPm`, `GBP`, `USD`, `EUR`, `Updated`)
VALUES(NULL, 'Gold', 'AM', '1055.91', '1646.00', '1272.03', '2012-06-19')

Upvotes: 1

Ryan
Ryan

Reputation: 14649

 INSERT INTO LondonFixes (id, Meta, AmPm, GBP, USD, EUR, Updated)
 VALUES(NULL, 'Gold', 'AM', '1055.91', '1646.00', '1272.03', '2012-06-19')

Upvotes: 3

Related Questions