Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Warum werden von mir hochgeladene Daten umbenannt und entsprechende Daten zu verschiedenen Zeilen hinzugefügt?

$result =  mysqli_query($connection, $query);
if ($result)
{
 // use echo "success, data has been inserted successfully or create a success page and redirect to another page from here
}
else
{
 // query fails
}


$_FILES['uploadedimage']['name'] will give you the original image name.

In deinem Code machst du das so,

$imagename=date("d-m-Y")."-".time().$ext; // you are adding date, time and extension of the image.
$target_path = "images/".$imagename;

Also, like

$imagename= $_FILES['uploadedimage']['name']; // `$imagename` will now contain spongebob.png
$target_path = "images/".$imagename; // images/spongebob.png

WICHTIG :

`mysql_*` is deprecated. Migrate it to `mysqli_*` or `PDO`. You code is vulnerable to SQL Injection.