Incorrect integer value
Im using
$insertQuery = "INSERT INTO workorders (`priority`, `request_type`) VALUES ('$priority', '$requestType')";
where $priority has value 0,1,2 or '' (empty value).
When the value of $priority is empty I get error "Incorrect integer value". In database I set priority default value = 0 and NULL. What I could do without changes in code?
Answer Answered by Ian Gilfillan in this comment.
''
means you are setting priority to a string, not an integer. You should use NULL (without quotes) instead, or, to set it to the default 0, leave priority out of the query altogether.
If you are unable to make these changes and can only make changes in MariaDB, not the code, then you have two options.
You can either change the column type to a string, though be aware that this may have consequences elsewhere in the code.
Alternatively, you can disable strict mode, which will accept the query as is, with a warning, and replace the string with the default, 0. Again, this change may have consequences elsewhere in the code.