Frage

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
War es hilfreich?

Lösung

You need to create the id column as primary key and autoincrement on the table tbl_sys_project_amenity and it will fix.

Andere Tipps

when you use cache database replace config database

$db['default']['cache_on'] = TRUE; $db['default']['cachedir'] = APPPATH . 'cache';

to

$db['default']['cache_on'] = false; $db['default']['cachedir'] = '';

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top