0

コントローラーからモデルに配列を渡す簡単な更新をしようとしています。しかし、次のエラーが発生します。

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); 
}

ここで私が間違っていることはありますか?

4

1 に答える 1