Welcome Guest, Not a member yet? Register   Sign In
DB/Query Error

function is_staff()
        $id = $this->ci->session->userdata('userid');
        $query = $this->ci->db->get_where('group_memberships', array('userid' => $id));
        $group = $query->row()->groupid;
        if ($group <= 2) {
            return true;

Which seems to give me this error:

Quote:A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: libraries/quickauth.php

Line Number: 184

But I have the exact same code right above (at Line: 173)
but it only detects the error at this line.

What does this tell you if you put it at the end of your function?

Ah it tells me NULL...

Although this was working before, so I have no idea what went wrong.

It seems
$id = $this->ci->session->userdata('userid');

Returns a boolean rather than the actual "ID", any suggestions on how to get the actual ID from the session?

It returns the value stored in the session, or FALSE if that value does not exist.

Ok, so this is the user_data from phpymadmin:

I don't know why it isn't finding what I want it to, i'm basing my code on what quickauth has used to get the userid in other functions, so I don't know why this isn't working...

Theme © iAndrew 2016 - Forum software by © MyBB