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

[eluser]TheFuzzy0ne[/eluser]
I'm guessing you are getting an error, but you can't see it as you've turned down the error reporting level. Can you confirm that this isn't the case?

I've tidied up your code a little. It may not make any difference, but it only took a few seconds, so I figured I should do it:
Code:
function copy_events_for_template($meet_id, $template_id, $host_id)
    {
        $this->db->where('meet_id', $meet_id);
        $events = $this->db->get('meet_events');

        foreach ($events->result_array() as $event)
        {
            $data['event_id'] = $event['event_id'];
            $data['gender'] = $event['gender'];
            $data['template_id'] = $template_id;
            $this->db->insert('meet_template_events', $data); // I think this line might be inserting over a row where the ID exists
        }
    }


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