title: Codeigniter Activerecord update method refuses to insert NULL value
body: <p>I'm using Codeigniters Active record library to carry out an update on a column on my DB. </p>
  
  <p>Here's the SQL for the table</p>
  
  <pre><code>CREATE TABLE `schedules` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `reservation_id` INT(11) NULL DEFAULT NULL,
  `title` VARCHAR(255) NOT NULL,
  `description` VARCHAR(512) NULL DEFAULT NULL,
  `start_date` DATE NOT NULL,
  `start_time` TIME NOT NULL,
  `end_time` TIME NULL DEFAULT NULL,
  `enabled` TINYINT(1) NULL DEFAULT '1',
  `status` ENUM('OPEN','RESERVED') NULL DEFAULT 'OPEN',
  PRIMARY KEY (`id`),
  INDEX `fk_schedules_reservations` (`reservation_id`),
  CONSTRAINT `fk_schedules_reservations` FOREIGN KEY (`reservation_id`) REFERENCES `reservations` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION
  </code></pre>
  
  <p>)</p>
  
  <p>I've declared reservation_id as nullable (<code>reservation_id INT(11) NULL DEFAULT NULL</code>)</p>
  
  <p>The problem is that CI doesn't seem to want to send a NULL value when I create the statement. </p>
  
  <pre><code>$data['status'] = $this-&gt;Schedule-&gt;get_status_open();
  $data['reservation_id'] = null; 
  $this-&gt;Schedule-&gt;update($s_id, $data);
  </code></pre>
  
  <p>That bit of code just generates the following error message </p>
  
  <pre><code>Error Number: 1452
  
  Cannot add or update a child row: a foreign key constraint fails (`ethyme/schedules`, CONSTRAINT `fk_schedules_reservations` FOREIGN KEY (`reservation_id`) REFERENCES `reservations` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION)
  
  UPDATE `schedules` SET `status` = 'OPEN', `reservation_id` = '' WHERE `id` = '4'
  </code></pre>
  
  <p>From what I know, all you have to do is set the value to NULL and AR should pick up that it's a NULL value, but that doesn't seem to be the case here. Just keeps sending empty values. </p>
  
  <p>I'm new to CI, do I have to do anything else to make it work? any ideas? </p>