I have this function,
public function storeVals($vals) { $vals = explode(",", $vals); foreach ($vals as $val) { $val = array('input'=>$val); $this->db->insert('input', $val); } } The function basically receives a string e.g: This,Is,An,Example
Then it turns the string into an array with "," as a delimiter.
Then it loops through the array and inserts the data into the DB.
Code Igniter, I think, already has the functionality to do this.
File: system/database/drivers/mysql/mysql_driver.php function _insert_batch($table, $keys, $values) { return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values); } Any ideas on how I can use insert_batch() instead of looping and inserting will be highly appreciated.
Thank you.