title: (CodeIgniter query builder) I'm getting a database insert error even though the insertion process works fine in the background
body: <pre><code>public function answerSurvey() {
      $id = $this-&gt;uri-&gt;segment(3);
      $i = 0;        
      $reserved = $this-&gt;mAttendee-&gt;getReserve($id, $this-&gt;session-&gt;username);
      $zxc = $reserved-&gt;registration_id;
      foreach ($_POST as $sample) {
          $value = $this-&gt;input-&gt;post("question_$i");
          $question = $this-&gt;input-&gt;post("id_$i");
          $qwe = array('answer_value' =&gt; $value, 'question_id' =&gt; $question, 'user_id' =&gt; $id);
          $this-&gt;MSurvey-&gt;addAnswer($qwe,$zxc);
          $i++;
      }
      redirect(base_url() . "attendee/viewEvent/$id");
  </code></pre>
  
  <p>Above is the snippet in my controller where I pass data from my looped post values into the database. When I run this method, I get a database error that says something along the lines like</p>
  
  <blockquote>
    <p>'answer_value' and 'question_i' cannot be null</p>
  </blockquote>
  
  <p>even though as you can see I passed data onto these values through the $value and $question variables. When I checked the database, the process of insertion seems to be working fine as my data is passed onto the tables. Why am I getting this error and how can I fix it? My current solution was disabling the debugging in the database config. Thank you.</p>