我正在尝试做一个简单的更新,将一个数组从控制器传递给模型。但我收到以下错误:
Error Number: 1064 You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax
to use near 'id #29
这是正在传递的数组:
<?
$data = Array
(
[name] => last_name
[value] => Smith
[pk] => 611
);
控制器
<?
function edit_client() {
$data = $this->input->post();
$this->load->model('clients_model');
$this->clients_model->update_client_info($data);
}
模型
<?
function update_client_info($data) {
$update = $this->db->set($data['name'], $data['value']);
$this->db->where('id', $data['pk']);
$this->db->update('clients', $update);
}
有什么想法我在这里做错了吗?