I get the "Fatal error: Cannot access empty property in /Applications/XAMPP/xamppfiles/htdocs/cityland/application/libraries/Grocery_CRUD.php on line 1540" error in this code
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 is an accociative entity of tbl_sys_amenities and tbl_sys_projects. This error only shows up in this specific table.
My table structure
tbl_sys_amenities
amenity
description
tbl_sys_projects
project_id
title
location
tbl_sys_project_amenity
project_id
amenity
quantity
You need to create the id
column as primary key
and autoincrement
on the table tbl_sys_project_amenity
and it will fix.