title: not insert into particular field and parrticular name
body: <p>i want to insert picture in particular name but there is no insert and some facing error</p>
  
  <p>my table like this</p>
  
  <p><a href="https://i.stack.imgur.com/RRaTb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RRaTb.png" alt="enter image description here"></a></p>
  
  <p>how can insert pic in front of particular name </p>
  
  <p>config.php file is</p>
  
  <pre><code>&lt;?php
  session_start();
  
  $db = new mysqli('localhost','root','','dharmesh'); 
  ?&gt;
  </code></pre>
  
  <p>and code is here :</p>
  
  <pre><code>&lt;?php
  include_once('config.php');
  if(isset($_POST['family_member_btn'])) {
  
              $family_member = $_POST['family_member'];
  
  }
  if(isset($_POST["submit4"])) {
      for($i=0;$i&lt;$_POST['num'];$i++) {
  
          $insert = $db-&gt;query("INSERT into `multiple_insert` (`f_name`,`m_name`,`l_name`,`birth_date`) values ('".$_POST['f_name'][$i]."','".$_POST['m_name'][$i]."','".$_POST['l_name'][$i]."','".$_POST['b_date'][$i]."')");
  
          if($insert) {
              echo "&lt;script&gt;alert('insert successfully');&lt;/script&gt;";
          } else {
              echo "&lt;script&gt;alert('!!!insert unsuccessfully');&lt;/script&gt;";
  
          }
      }
  }
  
  if(isset($_POST["upload"])) {
      for($i=0; $i&lt;$_POST['img'];$i++) {
  
          $imag = $_FILES['f_name_pic']['name'][$i];
          $tmp = $_FILES['f_name_pic']['tmp_name'][$i];
          $dir = "images/".$imag;
          move_uploaded_file($tmp,$dir);
  
          $query = $db-&gt;query("UPDATE `multiple_insert` SET `picture`='$dir' WHERE f_name='".$_POST['f_name'][$i]."' where user_id='1'");
      }
  }
  ?&gt;
  
  
  
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;
  &lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form method="post" action=""&gt;
  &lt;?php
  
  $select  = $db-&gt;query("SELECT * from multiple_insert where user_id='1'");
  while($select_f_name = $select-&gt;fetch_assoc()){
      echo "&lt;input type='hidden' value='1' name='img' /&gt;";
      echo "&lt;p style='background-color:red;color:yellow;width:5%;'&gt;".$select_f_name['f_name']."&lt;/p&gt;";
      echo "&lt;span&gt;&lt;input type='file' name='f_name_pic[]' /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;";
  
  }
  echo "&lt;button name='upload'&gt;Uplaod&lt;/button&gt;&lt;br&gt;&lt;br&gt;";
  ?&gt;      
  
  
          &lt;label&gt;&lt;font size="2"&gt;HOW MANY MEMBER IN YOUR FAMILY ?&lt;/font&gt;&lt;/label&gt;&lt;br&gt;&lt;br&gt;
          &lt;input type="text" name="family_member" class="form-control" /&gt;
          &lt;button type="submit" name="family_member_btn" class="btn btn-lg btn-info"  /&gt;&lt;span&gt;SUBMIT&lt;/span&gt;&lt;/button&gt;&lt;br&gt;&lt;br&gt;
  
          &lt;?php
              for($i=1;$i&lt;=$family_member;$i++) {
  
          ?&gt;
          &lt;input type="hidden" value="&lt;?php echo $family_member;?&gt;" name="num" /&gt;
          &lt;label&gt;&lt;b&gt;&lt;?php echo "RECORED # &amp;nbsp;".$i;?&gt;&lt;/b&gt;&lt;/label&gt;&lt;br&gt;
          &lt;label&gt;&lt;font size="2"&gt;First Name&lt;/font&gt;&lt;/label&gt;
          &lt;input type="text" name="f_name[]" class="form-control"   /&gt;&lt;br&gt;
          &lt;label&gt;&lt;font size="2"&gt;Middle Name&lt;/font&gt;&lt;/label&gt;
          &lt;input type="text" name="m_name[]" class="form-control"  &gt;&lt;br&gt;
          &lt;label&gt;&lt;font size="2"&gt;Last name&lt;/font&gt;&lt;/label&gt;
          &lt;input type="text" name="l_name[]" class="form-control"  /&gt;&lt;br&gt;
  
          &lt;label&gt;&lt;font size="2"&gt;birthdate&lt;/font&gt;&lt;/label&gt;
          &lt;input id="datepicker3" class="form-control" name="b_date[]" type="text" /&gt;
  
          &lt;hr style="border:solid 2px rgba(0,0,0,0.2);"&gt;
          &lt;?php } ?&gt;  
  &lt;button class="btn btn-info  btn-cons from-left  pull-right" type="submit" name="submit4"&gt;
  &lt;span&gt;SUBMIT&lt;/span&gt;
  &lt;/button&gt;       
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>how can i done this please send me updated code for this...</p>