2013-08-03 49 views
2

我收到「致命錯誤:無法訪問第1540行中的/Applications/XAMPP/xamppfiles/htdocs/cityland/application/libraries/Grocery_CRUD.php中的空屬性」錯誤在此代碼Codeigniter和Grocery CRUD - 致命錯誤:無法訪問空屬性

public function projectAmenities() 
{ 
     $crud = new grocery_CRUD(); 

     $crud->set_theme('datatables'); 
     $crud->set_table('tbl_sys_project_amenity'); 
     $crud->set_relation('amenity','tbl_sys_amenities','amenity'); 
     $crud->set_relation('project_id','tbl_sys_projects','project_id'); 
     $crud->set_subject('Amenities'); 
     $output = $crud->render(); 
     $this->projectAmenitiesOutput($output); 
} 

tbl_sys_project_amenity是tbl_sys_amenities和tbl_sys_projects的accociative實體。此錯誤僅在此特定表中顯示。

我的表結構

tbl_sys_amenities

amenity 
description 

tbl_sys_projects

project_id 
title 
location 

tbl_sys_project_amenity

project_id 
amenity 
quantity 

回答

5

您需要創建id列作爲primary keyautoincrement在表tbl_sys_project_amenity並且它將被修復。

0

當你使用的緩存數據庫 更換配置數據庫

$ DB [ '默認'] [ 'cache_on'] = TRUE; $ db ['default'] ['cachedir'] = APPPATH。 「緩存」;

$分貝[ '缺省'] [ 'cache_on'] = FALSE; $ db ['default'] ['cachedir'] ='';

相關問題