Im stuck, been trying to figure this out for 2 hours now. I have figured out the foreach loop, but cant figure out how to insert the data now.
here is my php, what am I doing wrong?
$query = "INSERT INTO images (thumb_path, image_path, main_image, project_id) VALUES ";
foreach($_POST as $key => $value) {
$query .= "$thumb_path,$image_path,$main_image,$_POST[project_id])";
$result = mysql_query($query, $connection);
}
Thanks!
Should I lay it out like this, sorry still a newbie to foreach and how it works.
foreach($_POST as $key => $value) {
$query = "INSERT INTO images VALUES (thumb_path, image_path, main_image, project_id),";
$query .= "$value[thumb_path], $value[$image_path], $value[$main_image], '$_POST[project_id'])";
}
$result = mysql_query($query, $connection);