I migrated a PHP server and I'm not able to solve this error below

42 Views Asked by At

I use phpMyAdmin and MySQL version is: 8.0.36

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1525 Incorrect DATE value: '' in...

I saw some other questions about this, but none fixed my problem.

I tried to run some SQL commands Like:

ALLOW_INVALID_DATES. set optimizer_switch="derived_condition_pushdown=off";

1

There are 1 best solutions below

0
Pratik Gadoya On

You can't set the date field value with a blank string(''). You need to add a condition here that if your field value is blank, add the value as null.

For eg.

$date_field = $date_field ? $date_field : null