title: how to insert into data base table files names as array in one column
body: <p>i have a table t1 have two column id and name i want to insert files names in one column </p>
  
  <pre><code>&lt;input type="file" name="files[]" multiple&gt;&lt;/br&gt;
  &lt;input  type="submit"  name="submit"  value="ADD"&gt;
  </code></pre>
  
  <p>table</p>
  
  <pre><code>id | name
  1  | e1.jpg, e2.jpg, ....
  </code></pre>
  
  <p>i tried </p>
  
  <pre><code>if (isset($_POST['submit'])) {
      $output = '';  
      if(is_array($_FILES))   
      {  
          foreach ($_FILES['files']['name'] as $name =&gt; $value)  
          {  
              $file_name = explode(".", $_FILES['files']['name'][$name]);  
              $allowed_ext = array("jpg", "jpeg", "png", "gif");  
              if(in_array($file_name[1], $allowed_ext))  
              {  
                  $new_name = md5(rand()) . '.' . $file_name[1];  
                  $sourcePath = $_FILES['files']['tmp_name'][$name];  
                  $targetPath = "picem/".$new_name;  
                  $sql = "INSERT INTO phem (userid, username, img, date) VALUES 
        ('$id_user','$user','{$targetPath}','$myDate')";
                  $image = mysqli_query($conn,$sql);
                  if(move_uploaded_file($sourcePath, $targetPath))  
                  {  
                  }                 
              }            
          } 
      }
  } 
  </code></pre>
  
  <p>but this code will insert each file in a row</p>