You are using an
$id
variable in your model, but your are plucking it from nowhere. You need to pass the $id
variable from your controller to your model.Controller
Lets pass the $id to the model via a parameter of the
row_delete()
method.function delete_row()
{
$this->load->model('mod1');
// Pass the $id to the row_delete() method
$this->mod1->row_delete($id);
redirect($_SERVER['HTTP_REFERER']);
}
Model
Add the $id to the Model methods parameters.
function row_delete($id)
{
$this->db->where('id', $id);
$this->db->delete('testimonials');
}
The problem now is that your passing the
$id
variable from your controller, but it's not declared anywhere in your controller.
No comments:
Post a Comment