Thank you for all the help and suggestions. Here's my answer to my problem:
view
<td><a href ="<?php echo site_url('helloworld/delete/'.$row->user_no);?>">delete</a></td>
controller
function delete($user_no) {
$this->load->model("dbmodel");
$this->dbmodel->delete_row($user_no);
}
model
public function delete_row($id){
$this -> db -> where('user_no', $id);
$this -> db -> delete('users');
redirect('helloworld/');
}
I hope this can help you :)
I am new in codeigniter. I'm trying to delete a specific row but I always get this error:
404 Page Not Found
The page you requested was not found.
Here is my code in my view:
<td><?php echo anchor('helloworld/delete_row?id='.$row->user_no, 'DELETE', 'id="$row->user_no"'); ?></td>
model:
function row_delete($id) {
$this->db->where('user_no', $id);
$this->db->delete('users');
}
controller:
function delete_row(){
$id = $this->input->get('id');
$this->load->model('dbmodel');
$this->dbmodel->row_delete($id);
}