title: Issue: Importing csv with phpMyAdmin Works, Php Script treats csv import differently
body: <p>I've been working with this script which I believe is a bit antiquated. The issue I'm having is when I import a csv file(6000+ records) using phpMyAdmin it work fine, however, when I import the same csv file with this php script it corrupts the field order.</p>
  
  <p>Only the first two records are imported. The 2nd record imported does not import correctly as the first field of the second record, is included in the last field of the first record thus it seems the import process is not recognizing the line break for the next record. I tried saving the csv file as utf8, as well as, ascii. In either scenario it does not make a difference.</p>
  
  <p>Any ideas to modifying the script to treat the csv file the same way phpMyAdmin does?</p>
  
  <pre><code>&lt;?php
  
  include "connect.php"; //Connect to Database
  
  $deleterecords = "TRUNCATE TABLE plfwinvtable"; //empty the table of its current records
  
  mysqli_query( $conn, $deleterecords );
  
  //Upload File
  
  if (isset($_POST['submit'])) {
  
      if (is_uploaded_file($_FILES['filename']['tmp_name'])) {
  
          echo "&lt;h1&gt;" . "File ". $_FILES['filename']['name'] ." uploaded successfully." . "&lt;/h1&gt;";
  
          echo "&lt;h2&gt;Displaying contents:&lt;/h2&gt;";
  
          readfile($_FILES['filename']['tmp_name']);
  
      }
  
      //Import uploaded file to Database
  
      $handle = fopen($_FILES['filename']['tmp_name'], "r");
  
      while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
  
          $import="INSERT into plfwinvtable(Barcode, Brand, Description, Category, Price, Size, Unit, ServeOz, NumDrinks, NameVar) values('$data[0]','$data[1]','$data[2]','$data[3]','$data[4]','$data[5]','$data[6]','$data[7]','$data[8]','$data[9]')";
  
          mysqli_query($conn, $import) or die(mysqli_error());
  
      }
  
      fclose($handle);
  
      print "Import done";
  
      //view upload form
  
  }else {
  
      print "Upload new csv by browsing to file and clicking on Upload&lt;br /&gt;\n";
  
      print "&lt;form enctype='multipart/form-data' action='upload.php' method='post'&gt;";
  
      print "File name to import:&lt;br /&gt;\n";
  
      print "&lt;input size='50' type='file' name='filename'&gt;&lt;br /&gt;\n";
  
      print "&lt;input type='submit' name='submit' value='Upload'&gt;&lt;/form&gt;";
  
  }
  
  ?&gt;
  </code></pre>