I have a PHP loop that’s auto-generating an array to INSERT into a table. But I get this error:
Database query failed: Incorrect integer value: '' for column 'id' at row 1
Last SQL query: INSERT INTO users(id, email, password, first_name, last_name) VALUES ('', 'test@user.com', 'fljhdsfsd', 'John', 'Doe')
I’ve tried setting the id field as No Null and Null, but that didn’t help.
Any ideas? Thanks in advance for your help.
Your Mysql is running in the strict mode. You have to pass the
NULLif you have no value for that column, if the column isauto incrementyou can keep out this column from query.Once try the below query, I believe this will work.