I have this code:
function insertGenre() {
$genres = explode(',',$this->input->post('genreName'));
foreach($genres as $genre) {
$temp = array(
'id' => null,
'name' => $genre,
'popular' => '0'
);
$data2[] = $temp;
}
return $data2;
$data = array(
'id' => null,
'name' => $this->input->post('genreName'),
'popular' => '0'
);
//$this->db->insert('genres',$data);
$this->db->insert_batch('genres',$data2);
}
It should run just fine (I ran through a couple of questions in here), but it doesn't. What am I doing wrong?