I am getting this error and I don't know what to do:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Welcome::$db
Filename: core/Model.php
Line Number: 52
Fatal error: Call to a member function insert() on null in C:\xampp\htdocs\site\application\models\account_model.php on line 38
Controller:
public function register()//function register in the controller
{
$this->load->model('account_model');
$this->account_model->create_account();
}
Model:
function create_account()//function insert.
{
$insertdata = array('id' =>'',
'firstname' => $this->input->post('fname'),
'username' => $this->input->post('email'),
'username' => $this->input->post('username'),
'password' => $this->input->post('pass'),
'role' => '1',
'status' => 'Active');
$insert = $this->db->insert('account', $insertdata);
return $insert;
}