0
How do I enter a date null
in that capacity?
$data_saida = $this->post('data_saida');
//aqui pega a data se não for vazia e formata
if($data_saida) {
$arraydata = explode("/", $data_saida);
$diamontado = $arraydata[2].'-'.$arraydata[1].'-'.$arraydata[0];
$data_saida = $diamontado;
}
The problem is that this date is not mandatory and if the user does not put anything on form
, it saves a date like 0000-00-00.
Is the field type in DBMS date and configured to allow nulls? Problems of this type are more related to the way the query inserts a null value.
– Gabriel Heming
Yes, date and null
– Rafael Meirim