Message: Trying to get property of non-object in fuel cms
    
        
                
            
                
                    I am getting error in my view file as  "Message: Trying to get property of non-object in fuel cms" . Where am i going wrong
Controller.php
function index()
	{
		if(!empty($this->data) && isset($this->data)) {
			$vars['data']= $this->data;
			$vars['gdata']= $this->list_stock();
}
else {
			redirect(fuel_url('#'));
	}
}
function list_stock() {	
		$this->load->model('stock_details_model');
		$gdata = $this->stock_details_model->list_items();
		$gdata['table'] = $this->stock_details_model->list_items();
		return $gdata;				
	}
Views :   
            	<?php 
            		foreach($gdata as $folder) {
            	?>            		
stocknumber ?>')"><?=$folder->stocknumber ?>             	<?php
            		}            	
            	?>
Model : (stock_details_model)
in list items method there is a query which gets the stock of entire unit                
 
         
     
 
                 
            
Comments
By the looks of that $vars['gdata'] is going to be an array of objects (or arrays) keyed with 'table'.
Is the second $gdata['table'] = ... there a mistake?
if not what does:
foreach ($gdata['table'] as $folder) { # If returning arrays $folder['stocknumber']; # If returning objects $folder->stocknumber; }Do for you?
Your models list_items() method seems a bit of an odd choice for this too.
class Stock_detail_model extends Base_module_record { }it was a problem with the return type