1

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>
2
Contributors
2
Replies
3
Views
4 Years
Discussion Span
Last Post by cssweb
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.