Hello, beauty?
I am doing an update in a table and am sending the array of data. However, I have a date field. Every time I update, it sends the field as 'dtnascimento' = ''
. When this data arrives in the database, my database hits the date as 0000-00-00
.
What I want to do: make a check if my the position of my array is null. If it is null, set the value to arrive in the database as (NULL) .
Below my current code:
function atualizarFuncionario($dados){
if ($dados['dtnascimento'] === '') {
$dados['dtnascimento'] = NULL;
}
$where = array(
'idfuncionario' => $dados['idfuncionario'],
'idempresa' => $dados['idempresa']
);
$this->db->update($this->tabela,html_escape($dados),$where);
}
If anyone knows, give a moral ai rs