First of all this type of doubts should be asked in coding forums like stackover kind of sites for better solutions!
You can get various scenarios solution there if you have any coding error.
If the string value is assigned to PHP script, that too the empty string is assigned meanly then you will get the error code Incorrect integer value.
Behind this scenario, the script which is running tries to update or insert the row with the entry integer may be with values assigning it as default ( 0 or Null, AUTO_INCREMENT) value.
When you load data from file to a MySQL table, you might run into this error: Data truncated for column ‘column_name’ at row # That error means the data is too large for the data type of the MySQL table column. So define length!
Note:
Your localhost SQL config ini file may be modified thats y It can run without any error!
Regarding your main question, I second what the others have already said:
If you have a column of type INT, it means you need to fill it with an integer value. If you then provide it with null or a string (even if the string value is a number), MySQL won’t accept it.
This might be due to a different database version or setting. “Strict SQL Mode” is a setting that comes to mind that could affect this. If you have this turned off on your local system, and it’s turned on the server, then your local database might accept invalid values but the server might not.
Given that there was a difference in behavior between local development and our servers, I do think it’s fair to consider that maybe the databases here are not working correctly.
Really? I personally would just exclude it from the column list in the INSERT statement so you can be sure MySQL will take the default value.
After all, if you have a column that’s nullable, but has a non-NULL default value, then it does matter. If you then provide NULL, I expect MySQL to store NULL, not the default value. If NULL then means “default value”, how would you ever set that nullable column to NULL?
But this might be a difference caused by server settings. If MySQL is configured to be more lenient, it would make sense to take the default value if you provide a NULL value where NULL is not allowed. But that’s just MySQL fixing your query error for you, rather than the way you’re supposed to do things.