i have a method which adds a new "course" to my database. A course has a start date and an end date. The end date can be NULL. Both fields are defined as DATE in MySQL, end_date has the 'is_null' option checked.
Everything works fine, but if the user doesn't enter an end_date, the system writes an empty DATE string(0000-00-00) into the row. What do I have to change in order to get the NULL into the column?
Code:
function add()
{
$c = new Course();
$related = $c->from_array($_POST, array(
'course_type',
'start_date',
'end_date',
'season'
));