【发布时间】:2015-09-22 09:11:05
【问题描述】:
我收到此错误,我不知道该怎么办:
遇到 PHP 错误
严重性:通知
消息:未定义属性:Welcome::$db
文件名:core/Model.php
行号:52
致命错误:在第 38 行的 C:\xampp\htdocs\site\application\models\account_model.php 中的 null 上调用成员函数 insert()
控制器:
public function register()//function register in the controller
{
$this->load->model('account_model');
$this->account_model->create_account();
}
型号:
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;
}
【问题讨论】:
标签: php codeigniter