title: Fastest way to import csv file into MYSQL
body: <p>This method uploads csv file to mysql .But upon thousands of data in csv file it takes lots of time to upload the data which is annoying.
              
  
  <pre><code>        $deleterecords = "TRUNCATE TABLE discount"; //empty the table of its current records
          mysql_query($deleterecords);
          //readfile($name);
          //Import uploaded file to Database
          $handle = fopen($name, "r");
  
          $i=0;
          while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
          if($i&gt;0){
              $import="INSERT into discount(id,title,expired_date,amount,block)values('".$data[0]."','".$data[1]."','".$data[2]."','".$data[3]."','".$data[4]."')";
          //imports data serially to the allocated columns.
              mysql_query($import) or die(mysql_error());//query
          }
          $i=1;
          }
          fclose($handle);
         //closing the handle
         // print "Import done ";
         ?&gt;
  
  Can anyone suggest faster method for uploading data ?
  </code></pre>