插入时CodeIgniter Array to String转换

I can't seem to figure out what's wrong with my code and I'm out of my wit already. I spotted the specific line where the error occurred by die(). This should have worked because I've similar codes as this one that worked.

controller

foreach($course_rows as $key => $val ) {
    $course_fields = array(
        'CourseCode' => $val,
        'CourseDesc' => $course_desc[$key],
        'programID' => $id
    );

    die($course_result = $this->model_admin->insert_course($course_fields));
}

model

function insert_course($data) {
    $this->db->insert('course', $data);

}

You want to use different function instead of die(), I presume you would like to use print() or echo(), so foreach loop can do at least one cycle.

In other words get rid of die().

foreach($course_rows as $key => $value ) {
    $course_fields = array(
            'course_code' => $val,
            'course_desc' => $course_desc[$key],
            'program_id'  => $id,
    );

    $this->model_admin->insert_course($course_fields);
}

Your model function does return no information (null) there is no use of printing anything, in case you want your model to return boolean or last inserted id, comment on your logic.