10-05-2012, 10:48 PM
[eluser]RMinor[/eluser]
Maybe it's just late and my brain is fried, but I can't seem to figure out how to take the contents of the array below and save it into my database table. Here is the array:
The controller code will take each photo and insert it into the database. Here is the model that will be saving each photo and thumbnail:
Can somebody help me out here? Thanks in advance.
Maybe it's just late and my brain is fried, but I can't seem to figure out how to take the contents of the array below and save it into my database table. Here is the array:
Code:
print_r($insert_data);
Array ( [photo] => Array ( [0] => large_pic24.jpg [1] => large_pic25.jpg [2] => large_pic26.jpg [3] => large_pic27.jpg ) [thumbnail] => Array ( [0] => large_pic24_thumb.jpg [1] => large_pic25_thumb.jpg [2] => large_pic26_thumb.jpg [3] => large_pic27_thumb.jpg ) )
The controller code will take each photo and insert it into the database. Here is the model that will be saving each photo and thumbnail:
Code:
public function insertPhoto($photo, $thumbnail, $person_id)
{
$data = array (
'photo_photo' => $photo,
'photo_thumbnail' => $thumbnail,
'photo_person' => $person_id
};
$this->db->insert('photo', $data);
if ($this->db->affected_rows() == 1) {
return TRUE;
}
return FALSE;
}
Can somebody help me out here? Thanks in advance.