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

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

Severity
Notice

Message
Trying to get property of non-object

Filename
models/Crud_model.php

Line Number
924

Backtrace
:

File: /Users/Public/Git/Acme/acme.dev/application/models/Crud_model.php
Line
924
Function: _error_handler

File
: /Users/Public/Git/Acme/acme.dev/application/models/Crud_model.php
Line
968
Function: is_added_by

File
: /Users/Public/Git/Acme/acme.dev/application/views/back/includes_bottom.php
Line
115
Function: is_sale_of_vendor

File
: /Users/Public/Git/Acme/acme.dev/application/views/back/index.php
Line
32
Function: include

File: /Users/Public/Git/Acme/acme.dev/application/controllers/Vendor.php
Line
32
Function: view

File
: /Users/Public/Git/Acme/acme.dev/index.php
Line
292
Function: require_once 

And here comes the method from my Model:


PHP Code:
   function is_added_by($type,$id,$user_id,$user_type 'vendor') {
 
      $added_by json_decode($this->db->get_where($type,array($type.'_id'=>$id))->row()->added_by,true);  
        if
($user_type == 'admin'){
 
           $user_id $added_by['id'];
 
       }
 
       if($added_by['type'] == $user_type && $added_by['id'] == $user_id){
 
           return true;
 
       } else {
 
           return false;
 
       }
 
   
The line 924 is the one with json_decode.

Any help is appreciated!
Reply


Messages In This Thread
Trying to get property of non-object - by castle - 04-02-2017, 09:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB