【发布时间】:2019-06-19 19:08:43
【问题描述】:
当我更新一列时,会更改所有列。 我该如何解决?
型号
public function update($where, $data)
{
$this->db->update($this->table, $data, $where);
return $this->db->affected_rows();
}
控制器:
public function ajax_update()
{
$data = array(
'book_title' => $this->input->post('book_title'),
'book_isbn' => $this->input->post('book_isbn'),
'book_yop' => $this->input->post('book_yop'),
'book_active' => $this->input->post('book_active'),
'publisher_name' => $this->input->post('publisher_name'),
'author_name' => $this->input->post('author_name'),
);
$this->user_model->update( $this->input->post('book_id'), $data);
echo json_encode(array("status" => TRUE));
}
【问题讨论】:
标签: php ajax codeigniter