Multiple insert not working but single is.

I'm using datagrid that has a save-selected option. However it's only saving a single row when selected or if you select multiple it only saves the last row edited. Here is the update function. Am I doing something wrong?

public function ext_update() {

        $records = explode('||', $_POST['postdata']);

        foreach ($records as $row) {
            $field = explode(';', $row);

            $data = array(
                'name' => $field[1],
                'event' => $field[2],
                'result' => $field[3],
                'status' => $field[4]

            if (is_numeric($field[0])) {
                $this->db->where('id', $field[0]);
                $this->db->update('pullup_results', $data);
            } else {
                $this->db->insert('pullup_results', $data);

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.