Din $filepath
variabel och din query
måste vara i din loop.
Du använder också mysql_query
som inte är kompatibel med mysqli_
funktioner.
Dessa två API:er gör det inte blanda ihop. Använd mysqli_query
samtidigt som DB-anslutning skickas till den.
<?php
$con=mysqli_connect("abc.com","abc","ab","abc");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if(isset($_POST['submit']))
{
extract($_POST);
if(isset($_FILES['support_images']['name']))
{
$file_name_all="";
for($i=0; $i<count($_FILES['support_images']['name']); $i++)
{
$tmpFilePath = $_FILES['support_images']['tmp_name'][$i];
if ($tmpFilePath != "")
{
$path = "propertyimages/"; // create folder
$name = $_FILES['support_images']['name'][$i];
$size = $_FILES['support_images']['size'][$i];
list($txt, $ext) = explode(".", $name);
$file= time().substr(str_replace(" ", "_", $txt), 0);
$info = pathinfo($file);
$filename = $file.".".$ext;
if(move_uploaded_file($_FILES['support_images']['tmp_name'][$i], $path.$filename))
{
$file_name_all.=$filename."*";
}
}
$filepath = rtrim($file_name_all, '*').$path;
$query=mysqli_query($con,"INSERT into propertyimages (`propertyimage`) VALUES('".addslashes($filepath)."'); ");
}
}
else
{
$filepath="";
}
if($query)
{
header("Location: admin_profile.php");
}
}