PHP Codeigniter delete返回true,但未删除表
如果我没记错的话,我在一个月前就已经测试过这个函数了。现在不是了 这就是模型:PHP Codeigniter delete返回true,但未删除表,php,mysql,codeigniter,Php,Mysql,Codeigniter,如果我没记错的话,我在一个月前就已经测试过这个函数了。现在不是了 这就是模型: function delete($table, $id) { $query = $this->db->delete($table, array('id'=>$id)); //return $this->db->affected_rows(); return $query; } 我在我的控制器上使用它: $schedule_id = $this->post
function delete($table, $id) {
$query = $this->db->delete($table, array('id'=>$id));
//return $this->db->affected_rows();
return $query;
}
我在我的控制器上使用它:
$schedule_id = $this->post('id');
$result = $this->schedule_m->delete('schedule', $schedule_id);
if($result == true )
{
$this->response(array('result' => 'true'), 200);
}
响应始终为true,但该行永远不会被删除
我试图返回$this->db->受影响的行()
并使用var\u dump
,结果是int(0)
请帮助我。谢谢您的时间。尝试使用
WHERE
条件
function delete($table, $id) {
$this->db->where('id' , $id);
$query = $this->db->delete($table);
}
还要检查表是否仍有相同的字段
id
正在工作..我不知道发生了什么事@@。我将在9分钟内接受你的回答(SO的系统)。谢谢