0
我是codeigniter的新手,尝试使用来更新记录REST控制器但无法在此成功。无法在代码更新中使用post方法
我控制器代码:
function user_post()
{
$data = array(
'title' => $this->post('title'),
'text' => $this->post('text')
);
$result = $this->hello_model->update_entry($this->post('id'), $data);
if($result === FALSE)
{
$this->response(array('status' => 'failed'));
}
else
{
$this->response(array('status' => 'success'));
}
}
我型号代码:
public function update_entry($id,$data)
{
$this->db->where('id', $id);
$this->db->update('news', $data);
}
什么错误? – Elby
不能得到任何错误,它会返回成功,但不会更新表中的数据。 –
检查print_r($结果)的结果 – Elby