如何使用Postgresql和Codeigniter更新多个表

时间:2019-04-28 11:44:58

标签: php codeigniter

我有数组形式的数据,我希望将它们更新为多个表。我正在使用Codeigniter和Postgresql

这是我的控制器

public function update()
{
    $where = array(
        'id' => $this->input->post('id')
    );

    $data = array(
        'case_name' => $this->input->post('txtCaseName'),
        'firm_name' => $this->input->post('txtFirmName'),
        'case_description' => $this->input->post('txtCaseOverview'),
        'service_names' => $this->input->post('txtDesiredServices'),
        'instruction' => $this->input->post('txtinstruction'),
    );

    //print_r($data);
    //die;

    $this->HomeModel->update($data, $where);

这是我的模型:

var $table = array('tracker.case_main,
    tracker.case_overview,
    tracker.type_of_services,
    tracker.instructions');
//(tracker is my scheme name)

public function update($data, $where)
{   
    $this->db->update($this->table, $data, $where);
    return $this->db->affected_rows();
}

接收错误:

  

错误号:42601/7   错误:“数组”处或附近的语法错误   第1行:UPDATE数组SET“ case_name” ='Mary Garner',“ firm_name” = ...                  ^

更新数组SET“ case_id” ='Medidoco_001sa',“ case_name” ='Mary Garner',“ firm_name” ='xyz',“ case_description” ='',“ service_names” ='', “指令” =“,” id“ ='78'

文件名:C:/xampp/htdocs/casetrackings/system/database/DB_driver.php

行号: 691

我是php和codeigniter的新手:P

0 个答案:

没有答案