Welcome Guest, Not a member yet? Register   Sign In
$this->db->insert Within Loop
#1

[eluser]Jay Logan[/eluser]
Why doesn't this work? I don't get an error. But only 1 entry is inserted into the database. I did a print_r on the $events variable and there are about 25 items in it. I'm so confused.

Code:
function copy_events_for_template($meet_id, $template_id, $host_id)
    {
        $this->db->select();
        $this->db->from('meet_events');
        $this->db->where('meet_id', $meet_id);
        $get_events = $this->db->get();
        $events = $get_events->result_array();
        foreach ($events as $event)
        {
            $data['event_id'] = $event['event_id'];
            $data['gender'] = $event['gender'];
            $data['template_id'] = $template_id;
            $this->db->insert('meet_template_events', $data);
        }
    }


Messages In This Thread
$this->db->insert Within Loop - by El Forum - 02-19-2009, 08:14 PM
$this->db->insert Within Loop - by El Forum - 02-20-2009, 12:28 AM
$this->db->insert Within Loop - by El Forum - 02-20-2009, 03:37 AM
$this->db->insert Within Loop - by El Forum - 02-20-2009, 04:03 AM
$this->db->insert Within Loop - by El Forum - 02-20-2009, 07:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB