2

I have a simple mysql database but get an error. It could be the field status, which is an notnull enum('actief', 'wachtend', 'verborgen'), but should be correct this way.

I have checked the comma's 50 times but maybe i'm staring at it too long now. I've tried googling it but still cant find the problem.

All the fields are notnull (i've left out the ones that can be null)

INSERT INTO `restaurants` (id_naam, korte_naam, lange_naam, straat, huisnummer, postcode, plaats, provincie, land, type_aanbieding, type_keuken, lat, long, status) VALUES ('test1', 'test1', 'Test restaurant 1', 'straatnaam', '1', '1234AB', 'plaatsnaam', 'Drenthe', 'landnaam', '2emenu', 'frans', '52', '5', 'verborgen');

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, status) VALUES ('test1', 'test1', 'Test restaurant 1', 'straatnaam', '1', ' at line 1

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Niels
  • 1,340
  • 2
  • 15
  • 32

1 Answers1

2

It must be the long field which is causing the error. It's a reserved word in MySQL, so you need to wrap it in backticks:

INSERT INTO `restaurants` (... `long`, status) VALUES ...

Nothing to do with enums though, as you can see.

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356