I want to update some data in mysql. Here is my controller:
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);
}
}
and my model:
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);
}
}
But when I tried to run the program, it says
Call to undefined method Ci_update::ci_update_model() in C:\wamp\www\ci\application\controllers\ci_update.php on line 19
What am I doing wrong?
Use as below
$this->load->model('ci_update_model');
$this->ci_update_model->updateData($data,$id);