【发布时间】:2014-06-12 07:20:22
【问题描述】:
我的问题在于这个模型。如果我删除 where 语句,查询将正确运行,但我需要 where 语句才能根据 id 更改一行。当我使用 where 语句运行查询时,我没有错误,但数据库中没有任何受影响的行。
public function update_goods()
{
$id=$this->input->post('ID');
$data=array(
'ID'=>$this->input->post('ID'),
'Title'=>$this->input->post('Title'),
'Value'=>$this->input->post('Value'),
'Description'=> $this->input->post('Description'),
);
$this->db->where('ID', $id);
$this->db->update('goods',$data);
}
【问题讨论】:
-
尝试回显 $id 。你拿到身份证了吗?
-
echo $this->db->last_query(); - 在更新查询结束时尝试此操作。
标签: php mysql sql codeigniter