Incorrect integer value: '' for column 'id' at row 1
To let MySQL generate sequence numbers for an AUTO_INCREMENT
field you have three options:
- specify list a column list and omit your auto_incremented column from it as njk suggested. That would be the best approach. See comments.
- explicitly assign NULL
- explicitly assign 0
3.6.9. Using AUTO_INCREMENT:
...No value was specified for the AUTO_INCREMENT column, so MySQL assigned sequence numbers automatically. You can also explicitly assign NULL or 0 to the column to generate sequence numbers.
These three statements will produce the same result:
INSERT INTO workorders (`priority`, `request_type`) VALUES(?, ?, ...)
INSERT INTO workorders VALUES(NULL, ?, ...)
INSERT INTO workorders VALUES(0, ?, ...)
That probably means that your id
is an AUTO_INCREMENT
integer and you're trying to send a string. You should specify a column list and omit it from your INSERT
.
INSERT INTO workorders (column1, column2) VALUES (?, ?)