Field doesn't have a default value

Hi,

I have created applications that work fine previously.

However, I am not sure why now I will keep getting “Field doesn’t have a default value” when I tried to add record. I need to manually set the field as default null.

Can anyone kindly advise? Thanks.

where exactly you have SET the default value? You can do it in the field properties or in the database structure or in your code.

Hello, the problem is in mysql. The specified column has no default value.
MySQL Strict Mode is enabled.
You can change in the mysql config file

/etc/mysql/my.cnf

An easier way, set the column default value.

Example


ALTER TABLE tableName MODIFY COLUMN columnName VARCHAR(255) NOT NULL DEFAULT '';

OR


ALTER TABLE tableName MODIFY COLUMN columnDate DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';

OR


ALTER TABLE tableName MODIFY COLUMN columnNumber DOUBLE NOT NULL DEFAULT '0.00000';

OR


ALTER TABLE tableName MODIFY COLUMN columnNumber INT(11) NOT NULL DEFAULT '0';