Sur*_*ika 1 php codeigniter sql-update
我是CI的新手,我想更新mysql中的一些数据.所以这是我的控制器
class Ci_update extends CI_Controller
{
function __construct() {
parent::__construct();
}
function index()
{
$data = array
(
'title' => 'Data Structure using C',
'text' => 'Data Structure Using C, for, IIIrd Sem VTU CSE students'
);
$id = 4 ;
$this->load->model('ci_update_model');
$this->ci_update_model($data,$id);
}
}
Run Code Online (Sandbox Code Playgroud)
我的模特是:
class Ci_update_model extends CI_Model
{
function __construct() {
parent::__construct();
}
function updateData($data,$id)
{
$this->db->where('id',$id);
$this->db->update('data',$data);
}
}
Run Code Online (Sandbox Code Playgroud)
但当我试图运行该程序时,它说Call to undefined method Ci_update::ci_update_model() in C:\wamp\www\ci\application\controllers\ci_update.php on line 19
我在做什么?
使用方法如下
$this->load->model('ci_update_model');
$this->ci_update_model->updateData($data,$id);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
247 次 |
| 最近记录: |