title: CodeIgniter get_where
body: <p>I’m attempting to use get_where to grab a list of all database records where the owner is equal to the logged in user.</p>
  
  <p>This is my function in my controller;</p>
  
  <pre><code>function files()
  {
      $owner = $this-&gt;auth-&gt;get_user();
  
      $this-&gt;db-&gt;get_where('files', array('owner =' =&gt; '$owner'))-&gt;result();
  }
  </code></pre>
  
  <p>And in my view I have the following;</p>
  
  <pre><code>&lt;?php foreach($query-&gt;result() as $row): ?&gt;
  
      &lt;span&gt;&lt;?=$row-&gt;name?&gt;&lt;/span&gt;
  
  &lt;?php endforeach; ?&gt;
  </code></pre>
  
  <p>When I try accessing the view, I get the error :  </p>
  
  <blockquote>
    <p>Fatal error: Call to a member function result() on a non-object in /views/account/files.php on line 1.</p>
  </blockquote>
  
  <p>Wondered if anyone had any ideas of what might be up with this?</p>
  
  <p>Thanks </p>