title: Codeigniter $this->db->where() not working
body: <pre><code>$this-&gt;db-&gt;from('posts');
  $this-&gt;db-&gt;where('id',$this-&gt;uri-&gt;segment(3));
  $data['query'] = $this-&gt;db-&gt;get();
  </code></pre>
  
  <p>I am trying to get one post using a where statement. I don't get any errors when I run this code. But in my view when I try to get <code>$query-&gt;result()-&gt;body</code> PHP gives me an error <code>Trying to get property of non-object.</code> So I ran <code>print_r($query)</code> and this is what it gave me:</p>
  
  <pre><code>(
      [conn_id] =&gt; Resource id #27
      [result_id] =&gt; Resource id #32
      [result_array] =&gt; Array
          (
          )
  
      [result_object] =&gt; Array
          (
          )
  
      [custom_result_object] =&gt; Array
          (
          )
  
      [current_row] =&gt; 0
      [num_rows] =&gt; 0
      [row_data] =&gt; 
  )
  </code></pre>
  
  <p>I have no idea why it won't get my specific post from the database. I know my database is in working condition. I use it elsewhere in my site. I also use <code>$this-&gt;db-&gt;where()</code> elsewhere on my site and it works perfect. I've also tried plugging in id's of posts instead of <code>$this-&gt;uri-&gt;segment(3)</code> and I get the same problem. What am I doing wrong?</p>