[eluser]Massimiliano Marini[/eluser]
Hi all,
In my form I've a textbox where it is possible to insert a date but it's optional.
When I do:
Code:
$event = array(
'name' => $this->input->post('name'),
'date_event' => $this->input->post('date_event')
);
$this->db->insert('events', $event);
I got this error:
Code:
A Database Error Occurred
Error Number: 1292
Incorrect date value: '' for column 'date_event' at row 1
INSERT INTO `events` (`name`, `date_event`) VALUES ('Foo', '');
My MySQL table is:
Code:
create table event(
name varchar(128),
date_event date default null, // I also have tried: null default '0000-00-00' nut nothing
);
but nothing, I can't insert my data into the table.
Why?