title: Codeigniter - Input post array insert into mysql database
body: <p>I dont understand how to exactly insert a row into a MySQL table. If I use my code, I add a new row for every post. Rather than that, I want only one row with all the values.</p>
  
  <p>Here is the code sample.</p>
  
  <p>HTML:</p>
  
  <pre><code>echo form_open('account/update'); 
    echo "&lt;p&gt;&lt;label for='gender'&gt;Gender&lt;/label&gt;
   &lt;input type='text' name='gender' id='gender'  value='".$gender."'  /&gt;  
    &lt;/p&gt;
    &lt;p&gt;
    &lt;label for='age'&gt;Age&lt;/label&gt;
    &lt;input type='text' name='age' id='age' value='".$age."' /&gt;
    &lt;/p&gt;
        &lt;p&gt;
    &lt;label for='bio'&gt;Biografie&lt;/label&gt;
    &lt;input type='text' name='bio' id='bio' value='".$bio."' /&gt;
    &lt;/p&gt;
        &lt;p&gt;
    &lt;label for='skills'&gt;Skills&lt;/label&gt;
    &lt;input type='text' name='skills' id='skills' value='".$skills."' /&gt;
    &lt;/p&gt;
  
    &lt;p&gt;&lt;input type='submit' value='Save' /&gt;&lt;/p&gt;";
  
  
   echo form_close(); 
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>function update() 
  {   
      $userid = $this-&gt;session-&gt;userdata("userid");
  
  
      $datanew = array(
             'userid' =&gt; $this-&gt;session-&gt;userdata("userid"),
             'gender' =&gt; $this-&gt;input-&gt;post('gender'),
             'age' =&gt; $this-&gt;input-&gt;post('age'),
             'bio' =&gt; $this-&gt;input-&gt;post('bio') ,
             'skills' =&gt; $this-&gt;input-&gt;post('skills')
          );
  $this-&gt;session-&gt;set_userdata($data);
      $this-&gt;load-&gt;model('model_account');
      $this-&gt;load-&gt;model("model_user");
  
      $this-&gt;model_account-&gt;profile_insert($datanew);
  
  $this-&gt;load-&gt;view("change_avatar");
      redirect("account/show/".$this-&gt;session-&gt;userdata("userid"));
  }
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>function profile_insert($datanew) 
  {   
  
    $this-&gt;db-&gt;insert('profile', $datanew);
  
  }
  </code></pre>
  
  <p>I get 5 rows if I submit the HTML form.</p>