My ISP has updated the shared server which hosts my application. It involved an update from MySQL 5.6, to MariaDB 10.3. The ISP writes: MariaDB is largely compatible with MySQL and most web applications are written to work just fine with MariaDB. In other words, they don't suffer from the minimal differences.
However, since the update many of my EDIT and INSERT do not work anymore and produce a fatal error. In my search I found:
On my further investigation I came across: https://forums.cpanel.net/threads/mariadb-10-2-disabling-strict-mode.635157/ According to this thread I understand the solution might be in changing the sql mode in the server settings from:
STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
to:
NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
I tried to change it through DirectAdmin/PHPAdmin variabes. Since it is a shared server I am not allowed to change the settings so I can not check (SUPER privilege needed).
I now have 3 questions:
Suggestions very much appreciated.
The problem is caused by writing empty values to the database. If in a form empty values are allowed it is saved as an empty string "". However, if the field in the database is of type INT or DOUBLE this causes the error. To resolve this the fields in the database tables need to be changed to type VARCHAR. Another option would be to change the queries to write empty strings to 0 values for INT, DOUBLE types. Changing the field types to VARCHAR is the easier solution.