when i submitted the form i get this error on my site
but i am sure of the config

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

<?php 

mysql_connect('localhost','ali_root','kingstone2012')or die (mysql_error());
mysql_select_db('ali_storeimage');

?>






<?

if ($_POST['submit'] ){

$file=$_FILES['file'];
$name=$_FILES['file']['name'];
$tmp_name=$_FILES['file']['tmp_name'];

foreach($name as $key=>$value){

$name_file=$name[$key];
$tmp_file=$tmp_name[$key];
$imgpath = rand().'.jpeg'; 
move_uploaded_file($tmp_file,'images/'.$imgpath);
$id=mysql_insert_id();
$insert=mysql_query("insert into  imagelocation values('','images/$imgpath'")or die (mysql_error());
$select=mysql_query("select * from imagelocation where id='$id' ");

while ($row=mysql_fetch_object($select)){
echo "<center><img src='$row->images'/></center><br/>";
}
}
}




?>





<form action='' method='post' enctype='multipart/form-data'>
<input type='file' name='file[]' multiple />
<input type='submit' name='submit'/>

</form>

Recommended Answers

All 2 Replies

Switch line 27 and 28.

well what is the proplem at line 27,28

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.