|
我刚刚学CI,请教一下为什么插不进去数据,代码如下:
<?php
class News extends Controller {
function News(){
parent:: Controller();
$this->load->helper('form');
}
function index()
{
$this->load->view('blog/newsview');
}
function create(){
$arr['title']=$this->input->post('title',true);
$arr['body']=$this->input->post('body',true);
$this->db->insert('entries ', $arr);
redirect('blog/newsview');
}
}
?>
插入数据时,报错如下:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: News:db
Filename: controllers/news.php
Line Number: 20
Fatal error: Call to a member function insert() on a non-object in E:\webpage\CodeIgniter\system\application\controllers\news.php on line 20
请高的指教一下. |
|