非常感谢您提供的所有帮助和建议。下面是我的回答我的问题:使用codeigniter删除特定行
视图
<td><a href ="<?php echo site_url('helloworld/delete/'.$row->user_no);?>">delete</a></td>
控制器
function delete($user_no) {
$this->load->model("dbmodel");
$this->dbmodel->delete_row($user_no);
}
模式
public function delete_row($id){
$this -> db -> where('user_no', $id);
$this -> db -> delete('users');
redirect('helloworld/');
}
希望这可以帮助你:)
我是新的codeigniter。我试图删除特定行,但我总是得到这样的错误:
404 Page Not Found
The page you requested was not found.
这里是我的代码在我观点:
<td><?php echo anchor('helloworld/delete_row?id='.$row->user_no, 'DELETE', 'id="$row->user_no"'); ?></td>
模式:
function row_delete($id) {
$this->db->where('user_no', $id);
$this->db->delete('users');
}
控制器:
function delete_row(){
$id = $this->input->get('id');
$this->load->model('dbmodel');
$this->dbmodel->row_delete($id);
}
您可以指定重现你得到,例如错误所需的步骤它的制作网址是? – kix 2014-10-03 06:11:03
我有这个在我的网址:http://localhost/ci/index.php/helloworld/delete_row/id/5 它可以得到我想要删除的id,但它说我请求的页面是未找到。 – 2014-10-03 06:30:10