Reputation: 71
I am getting an error in my code and don't know why. Here is the error :
Fatal error: Call to undefined method Display::index() in
Here is the controller part that causes the error:
function delete(){
$this->load->model('display_model');
$this->display_model->delete_row();
$this->index();
}
and model part if needed just in case:
function delete_row()
{
$this->db->where('QID', $this->uri->segment(3));
$this->db->delete('tblquestions');
}
Upvotes: 0
Views: 127
Reputation: 16086
Instead you can do like below:
function delete(){
$this->load->model('display_model');
$this->display_model->delete_row();
redirect('/controllerName/', 'refresh');
}
The benefit of redirect is that you can set some message to user that you completed or failed to do action by passing some id.
function delete(){
$this->load->model('display_model');
$this->display_model->delete_row();
redirect('/controllerName/index/1', 'refresh');
}
Upvotes: 2