PHP PDO or MYSQL is forcing me, from one day to the next, to save fields not null
of a table, before, if it was an integer, mysql automatically put a 0
.
Let me explain.
I have this table: clients
id int auto incremental not null
nombre text not null
apellidos text not null
id_usuario int not null
And this is my query:
INSERT INTO clientes(nombre, apellidos) VALUES(:nombre, :apellidos)
This query 1 day ago, without changing the code, I worked fine, filled the fields nombre
and apellidos
, automatically filled the field id
auto incrementándose and the field id_usuario
put a 0 automatically mysql And it did not give any error.
Today, it does not work anymore, it gives me the following error:
PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1364 Field 'id_usuario' doesn't have a default value.
It's also happening to me with the empty strings, before if I passed an empty string to a field int
, it automatically interpreted it as nothing and set the value 0
. Now give the error:
PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: ''
I think that Mysql has become restrictive from one day to the next, I do not know if it has been updated alone or that it has happened ... is there any way to change this so that it is as before?
EDIT: Viewing the log in Ubuntu, today at 6 am Mysql has been updated and passed from version 5.7.21 to 5.7.22. Surely it has something to do.
Greetings and thanks.