When I try to INSERT values in my database, using the following code:
INSERT INTO obra (codInstituicao, codInventariadaPor, dataInventariada,nome,codEstadoConservacao, .......) values (" . $codInstituicao ."," . $_SESSION['id']. ", NULL, '" . $nome ."' , '" . $codEstadoConservacao . "', ......)
In the beginning of this code, is declared:
$codEstadoConservacao = (empty($_POST['estadoconservacao']) ? "NULL" : $_POST['estadoconservacao']);
The TYPE of my tables is InnoDB. When I execute the INSERT, i got this error:
Incorrect integer value: 'null' for column 'codEstadoConservacao' at row 1