-1

Hello all I'm trying to do the following insert to my database however every time I try it it fails with a vender error of 1064. I have two double fields for the lat and long, and an integer id. Could someone tell me what's going on here?

INSERT INTO LatLong (lat, long) VALUES (51.53087375, -0.26259048);
Marc Alff
  • 8,227
  • 33
  • 59
Chris Maness
  • 1,682
  • 3
  • 22
  • 40

1 Answers1

5

The column long is a MySQL reserved word. Surround it with backticks to fix the error:

INSERT INTO `LatLong` (`lat`, `long`) VALUES (51.53087375, -0.26259048);

It's a good practice, but not necessary, to surround all of your column and table names with backticks as well.

newfurniturey
  • 37,556
  • 9
  • 94
  • 102
  • Thank you so much! As soon as it will let me mark this as an answer I will. I've struggled with this for a couple hours at least I would've never thought about it being a reserve word. – Chris Maness Jul 25 '12 at 20:11
  • Backticks; annoying little characters that provide so much relief! Glad I could help =] – newfurniturey Jul 25 '12 at 20:16