|
1、插入一條記錄
$data = array('title' => 'My title' ,'name' => 'My Name' ,'date' => 'My date');$this->db->insert('mytable', $data);// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date')
2、插入多條記錄
$data = array(array('title' => 'My title' ,'name' => 'My Name' ,'date' => 'My date'),array('title' => 'My title1' ,'name' => 'My Name1' ,'date' => 'My date1'));$this->db->insert_batch('mytable', $data);// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date'),('My title1', 'My name1', 'My date1')
php技術(shù):php CI框架插入一條或多條sql記錄示例,轉(zhuǎn)載需保留來源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時(shí)間聯(lián)系我們修改或刪除,多謝。