Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter get_where
#1

[eluser]doubleplusgood[/eluser]
Hi there,

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.

This is my function in my controller;

Code:
function files()
{
    $this->load->view('account/files');
    
    $owner = $this->auth->get_user();
    
    return $this->db->get_where('files', array('owner =' => '$owner'))->result();
}

And in my view I have the following;

Code:
<?php foreach($query->result() as $row): ?>

    <span>&lt;?=$row->name?&gt;</span>

&lt;?php endforeach; ?&gt;

When I try accessing the view, I get the Fatal error: Call to a member function result() on a non-object in /views/account/files.php on line 1.

Wondered if anyone had any ideas of what might be up with this?

Thanks


Messages In This Thread
CodeIgniter get_where - by El Forum - 10-16-2009, 04:42 AM
CodeIgniter get_where - by El Forum - 10-16-2009, 04:47 AM
CodeIgniter get_where - by El Forum - 10-16-2009, 04:56 AM
CodeIgniter get_where - by El Forum - 10-16-2009, 05:18 AM
CodeIgniter get_where - by El Forum - 10-16-2009, 05:27 AM
CodeIgniter get_where - by El Forum - 10-16-2009, 06:07 AM
CodeIgniter get_where - by El Forum - 10-16-2009, 06:15 AM
CodeIgniter get_where - by El Forum - 10-16-2009, 06:28 AM
CodeIgniter get_where - by El Forum - 10-16-2009, 06:37 AM
CodeIgniter get_where - by El Forum - 10-16-2009, 07:44 AM
CodeIgniter get_where - by El Forum - 10-16-2009, 07:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB