Trying to get property of non-object |
Hello,
My head is spinning and I cannot figure out why I'm getting the Trying to get property of non-object error. This is the error: PHP Code: A PHP Error was encountered And here comes the method from my Model: PHP Code: function is_added_by($type,$id,$user_id,$user_type = 'vendor') { Any help is appreciated!
As far as I can see the only object trying to access a property on that line is "db". Is the database lib loaded?
Or it could also be that 'get_where' failed to find a record in the db in which case row() will return null.
The database is loaded.
Is there any more info/code/log that I can provide here to help debug this issue?
The more I look at it the more certain I am that no matching record is found. I cannot tell you how many times I've been burned by thinking, "Well, I know that table is going to have data that matches the criteria I'm providing." It is wise to not assume anything. Try checking db results before proceeding.
PHP Code: $query = $this->db->get_where($type,array($type.'_id'=>$id))->row(); |
Welcome Guest, Not a member yet? Register Sign In |