I am trying to set SQL modes, I can't figure out how to do it using PDO. I am trying to set Traditional mode in MySQL and not allow invalid dates.
Can anyone help?
I am trying to set SQL modes, I can't figure out how to do it using PDO. I am trying to set Traditional mode in MySQL and not allow invalid dates.
Can anyone help?
Use this to clear the sql_mode variable:
$db_conn->query("SET SESSION sql_mode=''")->execute();
Or this to remove a specific item from it:
$db_conn->query("SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'WRITE_HERE_THE_NAME',''));")->execute();
If you want to make the change global, you would need to have some admin privileges.
SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'WRITE_HERE_THE_NAME',''));