title: Moved from linux/apache to IIs and codeigniter DB_driver.php is giving me errors, i can't have empty fields anymore?
body: <p>I was on Linux with apache.  I moved to a IIs server.
  I'm running codeigniter 2.0.0</p>
  
  <p>I have an insert with activerecords that inserts the data from a form to a database.  The database has default values for each fields.  It didn't use to be a problem.  Since the move, EVERY field in the form have to be filled out, or else i get  this error :</p>
  
  <pre><code>Une erreur de base de données s'est produite.
  Error Number: 1292
  
  Incorrect date value: '' for column 'DateNaissance' at row 1
  
  INSERT INTO `patients` (`Nom`, `Prenom`, `Initial`, `Responsable`, `DateNaissance`) VALUES ('!teststef354', '!teststef9879', '', '0', '')
  
  Filename: \system\database\DB_driver.php
  
  Line Number: 330
  </code></pre>
  
  <p>Maybe my codeigniter base files are old for the current php/mysql installation, so i will upgrade it one version at a time.  Is there any way to fix this?</p>
  
  <p>I have other applications running on that server, that i haven't made, like mrbs for example, and it works fine, and i see the tables have empty entries, no problems whatsoever.</p>
  
  <p>Edit :</p>
  
  <p>This is in my model</p>
  
  <pre><code>function add_patient($postdata)
          {
              $resultat=0;
              if(!empty($postdata))
              {
                  $resultat=$this-&gt;db-&gt;insert('patients',$postdata);
  
              }
              return $resultat;
          }
  </code></pre>
  
  <p>In my controller i have this :</p>
  
  <pre><code>$postdata = array (
  
          'Nom'=&gt; $_POST['Nom'],
          'Prenom'=&gt; $_POST['Prenom'],
          'Initial'=&gt; $_POST['Initial'],
          'Responsable'=&gt; $_POST['Responsable'],
          'DateNaissance'=&gt; $_POST['DateNaissance']
  );
  </code></pre>
  
  <p>I call the model with : </p>
  
  <pre><code>$patientsadd=$this-&gt;patients_model-&gt;add_patient($postdata);
  </code></pre>
  
  <p>EDIT : running the sql query in phpmyadmin gave me the same error.  Running the SQL query in the mysql command prompt gave me the same error also, so this is a MySQL problem.</p>
  
  <p>And here is the Create statement of the table :</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `patients` (
    `IdPatient` int(11) NOT NULL AUTO_INCREMENT,
    `Nom` varchar(50) DEFAULT NULL,
    `Prenom` varchar(50) DEFAULT NULL,
    `Initial` varchar(4) DEFAULT NULL,
    `Responsable` int(11) DEFAULT '0',
    `DateNaissance` date DEFAULT '0000-00-00',
    PRIMARY KEY (`IdPatient`)
  ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=397 ;
  </code></pre>
  
  <p>EDIT : OK so this works :</p>
  
  <p>This is what i did. I do have more fields than this but i shortened it for question purposes.</p>
  
  <p>All the text fields could be problematic so i will edit them all. At least this way i'm not passing an empty value to the model and MySQL won't choke on it. It does have default NULL values for the text fields (wanted that way) so this should solve this bug.</p>
  
  <pre><code>$postdata = array();
  
          $postdata['Nom'] =  $_POST['Nom'];
          $postdata['Prenom'] = $_POST['Prenom'];
          $postdata['Initial'] =  $_POST['Initial'];
          $postdata['Responsable'] =  $_POST['Responsable'];
  
          if (isset($_POST['DateNaissance']))
          {}else {$postdata['DateNaissance'] = $_POST['DateNaissance']; }
  </code></pre>
  
  <p>Thank you to all the commenters to help me pinpoint my problem's root!</p>
  
  <p>I still think i have a problem, i made a mistake, </p>
  
  <p>this part : </p>
  
  <pre><code>if (isset($_POST['DateNaissance']))
          {}else {$postdata['DateNaissance'] = $_POST['DateNaissance']; }
  </code></pre>
  
  <p>should be : </p>
  
  <pre><code>if (empty($_POST['DateNaissance']))
           {}else{$postdata['DateNaissance'] = $_POST['DateNaissance']; }
  </code></pre>