title: Codeigniter Delete query doesnt delete row
body: <p>Im trying to delete a row from the database. After deleting, the table being displayed should refresh and shows the current database (without the deleted row).</p>
  
  <p><em>Controller</em> </p>
  
  <pre><code>public function delete()
      {
          $this-&gt;load-&gt;database();
          $this-&gt;load-&gt;model('userdetailModel');
          $id=$this-&gt;input-&gt;get('user_id');
          $this-&gt;userdetailModel-&gt;deleteOne($id);
  
          $data['results'] = $this-&gt;userdetailModel-&gt;viewAll();
          $this-&gt;load-&gt;view('userView', $data);
  
      }
  </code></pre>
  
  <p><em>view</em></p>
  
  <pre><code>&lt;?php 
          foreach($results as $res): ?&gt;
  
          &lt;tbody&gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;center&gt;&lt;b&gt;&lt;?php echo $res-&gt;user_id; ?&gt;&lt;/center&gt;&lt;/b&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;center&gt;&lt;?php echo $res-&gt;first_name; ?&gt;&lt;/center&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;center&gt;&lt;?php echo $res-&gt;last_name; ?&gt;&lt;/center&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;center&gt;&lt;?php echo $res-&gt;gender; ?&gt;&lt;/center&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;center&gt;&lt;a href=" &lt;?= site_url('userController/view')?&gt; "&gt; View &lt;/a&gt;&lt;/center&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;center&gt;&lt;a href=" &lt;?= site_url('userController/edit')?&gt; "&gt; Edit &lt;/a&gt;&lt;/center&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;center&gt;&lt;a href=" &lt;?= site_url('userController/delete?id='.$res-&gt;user_id)?&gt; "&gt; Delete &lt;/a&gt;&lt;/center&gt;&lt;/td&gt;
  
              &lt;/tr&gt;
  
          &lt;/tbody&gt;
  
      &lt;?php endforeach; ?&gt;
      &lt;/table&gt;
      &lt;/center&gt;
      } ?&gt;
  </code></pre>
  
  <h2>user_id is a field name from the database. I followed some source code but I can't get it right. Please further explain to me what I am lacking in this code blocks.</h2>
  
  <p>Model</p>
  
  <pre><code>function viewAll() {
  
          $this-&gt;db-&gt;select('user_id, first_name, last_name, gender');
          $this-&gt;db-&gt;from('user_details');
          return $this-&gt;db-&gt;get()-&gt;result();
      }
  
  function deleteOne($id)
      {
      $this-&gt;db-&gt;select('*');
      $this-&gt;db-&gt;from('user_details');
      $this-&gt;db-&gt;where('user_id', $id);
      $this-&gt;db-&gt;delete('user_details');
  
      }
  </code></pre>