public function book_update()
{
$data = array(
'book_isbn' => $this->input->post('book_isbn'),
'book_title' => $this->input->post('book_title'),
'book_author' => $this->input->post('book_author'),
'book_category' => $this->input->post('book_category'),
);
$this->book_model->book_update(array('book_id' => $this->input->post('book_id')), $data);
echo json_encode(array("status" => TRUE));
}
我想要基于此输出的两个参数,这就是为什么
答案 0 :(得分:1)
在模型中
public function book_update(....)
{
$data = array(
...
);
$this->db->where('id', $id);
if (!$this->db->update('mytable', $data))
return false;
else
return true;
}
在控制器中
$result = $this->book_model->book_update(array('book_id' => $this->input->post('book_id')), $data);
echo json_encode(array("status" => $result));
以HTML格式
根据更新成功/失败,您将获得TRUE(假)。