Reputation: 7463
This is the query I am trying to run:
INSERT INTO Article (id, name, title, author, dateCreate, dateEdit, permissions, template, views, tags) VALUES ('', 'test_show', 'Test Show', '1', '2018-03-24 18:47:09', '2018-03-24 18:47:20', '', '', '', '')
When I run it on my production server, which is hosted on DreamHost, and I believe is running MySQL version 5.6, it works.
On my local testing machine, though, which is running MySQL Ver 14.14 Distrib 5.7.21
, when I run the same query I get this error:
#1366 - Incorrect integer value: '' for column 'id' at row 1
The database is structured exactly the same on both servers. Column 'id' is set to auto increment.
I need to make my local test server behave the same way my production server does, so is there some setting difference between the versions of MySQL that I need to adjust? In any case, how do I make the query work on my local test server?
Upvotes: 0
Views: 90
Reputation: 5055
since id is set to auto-increment, you don't need to add it in the query. Try this:
INSERT INTO Article (name, title, author, dateCreate, dateEdit, permissions, template, views, tags) VALUES ('test_show', 'Test Show', '1', '2018-03-24 18:47:09', '2018-03-24 18:47:20', '', '', '', '')
Upvotes: 1