Welcome Guest, Not a member yet? Register   Sign In
Active Record or SQL Question
#1

[eluser]bennyhill[/eluser]
Currently I am inserting multiple records at once with this code:

Code:
$data = array();
        foreach ($_POST['tableGuests'] as $key => $value)
        {
            $temp = '('.$value.','.$_POST['owner_id'].')';
            array_push($data, $temp);
        }
        
       $values = implode(",",array_values($data));
       $sql = "INSERT INTO `table` (`attendee_id`, `owner_id`) VALUES ".$values;
       $this->db->query($sql);

Is there a better, more simple way to do it with Active Record?


Messages In This Thread
Active Record or SQL Question - by El Forum - 10-24-2008, 08:17 AM
Active Record or SQL Question - by El Forum - 10-24-2008, 08:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB