|
config.php配置
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = "root";
$db['default']['database'] = "php";
$db['default']['dbdriver'] = "mysql";
Model类
<?php
class Dmczry_model extends Model{
function Dmczry_model(){
parent::Model();
}
function addDmczry(){
$data = array(
'czry_mc' => $this->input->xss_clean($this->input->post('name')),
'password' => $this->input->xss_clean($this->input->post('password')),
'bm_dm' => $this->input->xss_clean($this->input->post('bm_dm'))
);
$this->db->insert('dm_czry', $data);
}
}
?>
错误
A PHP Error was encounteredSeverity: Notice
Message: Undefined property: Dmczry_model::$db
Filename: models/dmczry_model.php
Line Number: 16
Fatal error: Call to a member function insert() on a non-object in F:\Apache\htdocs\codeign\system\application\models\dmczry_model.php on line 16 |
|