I need to insert null data if so come. I'm inserting data from EXCEL to my DB. The problem is that I made the table structure and field to allow nulls and also as a default to NULL.
The value is empty and pass all my logical validations but when inserted, left in 21:00:00
PHP :
if(!empty($r['tiempo_chip'])){
$resultados[$i]['tiempo_chip'] = $this->ExcelReader->timeFormat($r['tiempo_chip']);
}else{
$resultados[$i]['tiempo_chip'] = NULL;
}
Data :
[0] => Array
(
[numero] => 88
[tiempo_oficial] => 01:10:30
[tiempo_chip] =>
)
This is stored in the DB 21:00:00
CREATE TABLE IF NOT EXISTS `resultados` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`numero` int(11) NOT NULL,
`tiempo_oficial` time NOT NULL,
`tiempo_chip` time DEFAULT NULL,
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=133 ;