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