title: Insert statement with CodeIgniter -- so confused
body: <p>I'm doing well with CodeIgniter. I can do SELECT statements on my MySQL database with no problems at all. But, now I'm trying to do an INSERT statement. </p>
  
  <p>Note that I have not tried an UPDATE statement yet. </p>
  
  <p>After reading the docs, I'm so confused.</p>
  
  <p>This is what I have:</p>
  
  <p>contacts.php:</p>
  
  <pre><code>function add() {
  
      //echo "&lt;pre&gt;";print_r($_POST);
  
      $this-&gt;load-&gt;model('Contacts_model');
      $this-&gt;Contacts_model-&gt;insertContact($_POST);
  }
  </code></pre>
  
  <p>contacts_model.php:</p>
  
  <pre><code>function insertContact($_POST) {
  
      //echo "&lt;pre&gt;";print_r($_POST);
      $title = $_POST['title']; // I can echo this here. It works
      $f_name = $_POST['f_name']; // I can echo this here. It works
  
  
  
      $sql = "INSERT INTO contacts (title,f_name) " .
          "VALUES (" .
          $this-&gt;db-&gt;escape($title) .
          "," .
          $this-&gt;db-&gt;escape($f_name) .
          ")";
      $this-&gt;$db-&gt;query($sql);
  }
  </code></pre>
  
  <p>I've read about Active Record, but if that's what is messing me up, then I still don't realize what I'm doing wrong. All of the examples look exactly like mine. </p>
  
  <p>Help?</p>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>    $sql = "INSERT INTO contacts (title,f_name) VALUES ('$this-&gt;db-&gt;escape($title)','$this-&gt;db-&gt;escape($f_name)'";
      $this-&gt;$db-&gt;query($sql);
  </code></pre>
  
  <p>I've also tried it like this. And many other variants. It doesn't seem to be my syntax... I think. </p>