mysql_query("INSERT INTO `brugere` (`user`, `pic1` ,`pic2`, `pic3`, `pic4`, `pic5`) VALUES ( '$navn', '$pic1', '$pic2', '$pic3', '$pic4', 'pic5' )");
<?php $uploads_dir = '/pictures'; foreach ($_FILES["pictures"]["error"] as $key => $error) { $fields = ""; $values = ""; $count = 1; if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES["pictures"]["tmp_name"][$key]; $name = $_FILES["pictures"]["name"][$key]; if(move_uploaded_file($tmp_name, $uploads_dir."/".$name)) { $fields .= ", " . "`pic" . $count . "`"; $values .= ", " . "'" . $name . "'"; $count++; } } } if($query) { mysql_query("INSERT INTO `brugere` (`user`, " . $fields . ") VALUES ('" . $user . "', " . $values . ")"); } ?>