I have a table where I am inserting multiple rows at a time. The rows are getting inserted properly but the images are not getting inserted.
table1
------
id name
1  Abhi
2  Pritam
table2
------
id subid multipleimages
1  1     1.jpg
2  1     2.jpg
3  2     3.jpg
4  2     4.jpg
Above is the table structure. I have a form having dynamic values like "add more". So here is the below code for the form.
<form>
<input type="text" name="name[]">
<input type="file" name="multipleimages[]"> 
<button>Add more</button>
</form>
// Insert query in php
<?php
 $name=$_POST['name'];
 $lastid=array();
 foreach($name as $key=>$val){
   mysql_query("insert into table1 (name) values ('".$name."')");
   $lastid=mysql_insert_id();
 }
 foreach ($lastid as $key => $value){
  // here will be the image upload code.
  // insert into table 2 
 }
?>
 
    