grocery-crud
grocery-crud copied to clipboard
Issue Installing
Hi all,
I am having a bit of trouble installing Grocery CRUD. It is throwing this error after following the basic steps to get it working.
An uncaught Exception was encountered Type: Error
Message: Cannot call constructor
Filename: /var/www/html/CodeIgniter/application/models/Grocery_crud_model.php
Line Number: 40
Backtrace:
File: /var/www/html/CodeIgniter/application/libraries/Grocery_CRUD.php Line: 484 Function: model
File: /var/www/html/CodeIgniter/application/libraries/Grocery_CRUD.php Line: 4607 Function: set_default_Model
File: /var/www/html/CodeIgniter/application/libraries/Grocery_CRUD.php Line: 4625 Function: pre_render
File: /var/www/html/CodeIgniter/application/controllers/Main.php Line: 27 Function: render
File: /var/www/html/CodeIgniter/index.php Line: 308 Function: require_once
The Main.php file looks like this:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Main extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->database();
$this->load->helper('url');
/* ------------------ */
$this->load->library('grocery_CRUD');
}
public function index()
{
echo "<h1>Welcome to the world of Codeigniter</h1>";//Just an example to ensure that we get into the function
die();
}
public function ddtracker()
{
$crud = new grocery_CRUD();
$crud->set_table('ddtracker');
$output = $this->grocery_crud->render();
echo "<pre>";
print_r($output);
echo "</pre>";
die();
}
}
/* End of file Main.php */
/* Location: ./application/controllers/Main.php */
Note: this is running on php7.2 and apache2.4.x.
Use first letter in upercase to class name.
Try :
$crud = new Grocery_CRUD();
instead of :
$crud = new grocery_CRUD();
Unfortunately that didn't change anything
Comment out the lines from Grocery_crud_model.php file
// // function __construct() // { // // parent::__construct(); // } https://github.com/bcit-ci/CodeIgniter/commit/c45caeac4f45b83fbb3655f62638ebcf913981c8