Welcome Guest, Not a member yet? Register   Sign In
Trying to get property of non-object
#1

[eluser]awpti[/eluser]
Been moifying the Erkanaauth library (sort of.. just changing the logic) and I'm getting Trying to get property of non-object

Code:
function get_role($role) {
     $query = $this->CI->db->get_where('trb_roles', array('name' => $role), 1, 0);
     if ($query->num_rows() == 1)
     {
            return TRUE;
     }
     else
     {
            return FALSE;
     }
}

What in the hell did I screw up?

Called via:

$this->eauth->get_role('admin');
#2

[eluser]m4rw3r[/eluser]
On which line are you having this problem?
Because it indicates that you are trying to fetch a property from a string, array, int, or anything else that doesn't have properties. My guess is to check if CI and db are objects (and not a simple variable).
#3

[eluser]awpti[/eluser]
It's erroring out on the query line.

Kinda lost as to why. Works fine on my other site (literally a cut/paste of the same block of code working there).

I even brought over the code from the other site (entire tree -both are CI 1.6.1) and it's bombing out with the same error.




Theme © iAndrew 2016 - Forum software by © MyBB