INSERT IGNORE using Codeigniter

后端 未结 13 941
眼角桃花
眼角桃花 2020-12-08 19:52

I am trying to insert a few rows into the MySQL table using Codeigniter and Active Records.

PHP Code

$data = array(\'......\');  //          


        
13条回答
  •  温柔的废话
    2020-12-08 20:27

    solution :

    $sql = $this->db->set($data)->get_compiled_insert($table);
    $sql = str_replace('INSERT INTO', 'INSERT IGNORE INTO', $sql);
    $this->db->query($sql);
    

    works in codeigniter 3.0.6 :)

提交回复
热议问题