Skip to content


Call to a member function result() on a non-object error #1856

it-can opened this Issue · 2 comments

2 participants



I am seeing in my logs the following error on some of my custom queries:

Call to a member function result() on a non-object

class Test_Model extends CI_Model
    public function __construct()

    public function get_all($id)
        $query = $this->db->query("SELECT * FROM tbl WHERE id=?", array($id));

        return $query->result();   // Error is on this line

It seems to throw the error when the result set is empty.... Is this normal behavior?

Using the latest develop btw...


An empty result or a failed query? It's not expected behavior if it's the first, but I also don't see how that would happen if the query was successful.


Mmm I will take a look... could be a failed query somewhere... weird..

@it-can it-can closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.