Codeigniter core / model.php undefined property

I have never touched the model.php file, but I get this error. Jobprocess is my controller, and $lastname is a variable assigned correctly inside it. I do not know why this error is appropriate. This is using codeigniter framework

 Message: Undefined property: Jobprocess::$lastname Filename: core/Model.php Line Number: 50 
+7
source share
3 answers

Verify that the startup model is installed in the /config/autoload.php application on line 56.

 $autoload['libraries'] = array('database'); 

Secondly, make sure the php file name is lowercase (mymodel.php)

and finally, be sure to write down the first letter of your class name

 class Mymodel extends CI_Model{} 
+20
source

$ autoload ['libraries'] = array ('database'); in autoload.php I did a nettuts session on codeigniter and spent two hours and n number of cigarettes before I finally figured it out.

+2
source

I prefer to load the database into the Model class that we are writing than automatic loading through Config files.
For example:

 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class fruits_model extends CI_Model { private $fruits_table; public function __construct() { parent::__construct(); $this->load->database(); $this->fruits_table = 'fruits'; } 

Add the following line:

 $this->load->database(); 

Inside the constructor Model.

Hooray!

0
source

All Articles