I upgraded my php version from 7.1 to 7.2.
In my phpmyadmin I have a table like this one :
CREATE TABLE `images` (
`image_id` int(11) NOT NULL,
`image_name` varchar(255) CHARACTER SET utf8 NOT NULL,
`image_title` varchar(255) CHARACTER SET utf8 NOT NULL ,
`image_alternative` varchar(255) CHARACTER SET utf8 NOT NULL ,
`image_folder` varchar(255) CHARACTER SET utf8 NOT NULL ,
`image_status` int(11) NOT NULL ,
`date` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
image_id is the only required field. The rest, all optional and can be empty. When I'm trying to insert a record :
INSERT INTO `images`(`image_name`,`image_status`) VALUES ("new image",1);
I'm getting this error
MySQL said: Documentation #1364 - Field 'image_title' doesn't have a default value
To solve this issue I had to add in the table a predefined value for all fields or in my query to mention all fields even if they are empty.
INSERT INTO `images`(`image_name`, `image_title`, `image_alternative`, `image_folder`, `image_status`)
VALUES ("new image,"","","",0)
I understand that php 7.x is more secure from the old versions, and they are trying to make better with time. But how can I solve this issue without the need to change all my tables or my queries. Thank you