here is the all code:
- Code: Select all
<?php
$photo0=($_FILES['photo']['name']);
$photo1=($_FILES['photo1']['name']);
$photo2=($_FILES['photo2']['name']);
$photo3=($_FILES['photo3']['name']);
$photo4=($_FILES['photo4']['name']);
$photo5=($_FILES['photo5']['name']);
//This is the directory where images will be saved
$target = "images/upload/";
$targetx = $target . basename( $_FILES['photo']['name']);
//Writes the photo to the server
if(move_uploaded_file($_FILES['photo']['tmp_name'], $targetx))
{
//Tells you if its all ok
}
else {
//Gives and error if its not
}
$targetx = $target . basename( $_FILES['photo1']['name']);
//Writes the photo to the server
if(move_uploaded_file($_FILES['photo1']['tmp_name'], $targetx))
{
//Tells you if its all ok
}
else {
//Gives and error if its not
}
$targetx = $target . basename( $_FILES['photo2']['name']);
//Writes the photo to the server
if(move_uploaded_file($_FILES['photo2']['tmp_name'], $targetx))
{
//Tells you if its all ok
}
else {
//Gives and error if its not
}
$targetx = $target . basename( $_FILES['photo3']['name']);
//Writes the photo to the server
if(move_uploaded_file($_FILES['photo3']['tmp_name'], $targetx))
{
//Tells you if its all ok
}
else {
//Gives and error if its not
}
$targetx = $target . basename( $_FILES['photo4']['name']);
//Writes the photo to the server
if(move_uploaded_file($_FILES['photo4']['tmp_name'], $targetx))
{
//Tells you if its all ok
}
else {
//Gives and error if its not
}
$targetx = $target . basename( $_FILES['photo5']['name']);
//Writes the photo to the server
if(move_uploaded_file($_FILES['photo5']['tmp_name'], $targetx))
{
//Tells you if its all ok
}
else {
//Gives and error if its not
}
include "phpscripts/connect_to_mysql.php";
foreach(array($photo0, $photo1, $photo2, $photo3, $photo4, $photo5) as $value){
$sql="INSERT INTO `images` (`photo`,`ime`) VALUES('".$value."', 'spain')";
}
$result=mysql_query($sql);
I think that i have mistake in this code:
- Code: Select all
foreach(array($photo0, $photo1, $photo2, $photo3, $photo4, $photo5) as $value){
$sql="INSERT INTO `images` (`photo`,`ime`) VALUES('".$value."', 'spain')";
}
Thanks

