title: how to delete active records in the database using code igniter
body: <p>Controller:</p>
  
  <pre><code>public function delete()
  {
      $id=$this-&gt;uri-&gt;segment(3);
      $this-&gt;book_model-&gt;deletepost($id);
      $data['books']=$this-&gt;book_model-&gt;getposts();
      $this-&gt;load-&gt;view('showbooks',$data);
  }
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>public function getposts()
  {
    $posts=$this-&gt;db-&gt;get('books');
    $books=array();
    foreach ($posts-&gt;result() as $row) 
    {
      $books=array(
        'book_id' =&gt; $row-&gt;bookid,
        'book_name' =&gt; $row-&gt;booktitle,
        'book_author' =&gt; $row-&gt;bookauthor,
        'book_year' =&gt; $row-&gt;bookyear,
        'book_isbn' =&gt; $row-&gt;bookisbn,
        'book_publisher' =&gt; $row-&gt;bookpublisher
      );
    }
    return $books;
  }
  
  public function deletepost($id)
  {
    $this-&gt;db-&gt;where('id',$id);
    $this-&gt;db-&gt;delete('books');
  }
  </code></pre>
  
  <p>The problem is I can't delete the records. 
  This is the error: <code>Unknown column 'id' in 'where clause'</code></p>
  
  <pre><code>DELETE FROM `books` WHERE `id` = 0
  </code></pre>