CSV -Datei importieren Sie mit PHP in MySQLI

<?php

   if(!empty($_FILES['file']['name']))
   {
    $connect = new PDO("mysql:host=localhost;dbname=dn_tcs_project_data;", "root", "", array(
           PDO::MYSQL_ATTR_LOCAL_INFILE => true,
       ));
   $mysqli = new mysqli("localhost","root","","dn_tcs_project_data");
    $total_row = count(file($_FILES['file']['tmp_name']));
   
    $file_location = str_replace("\\", "/", $_FILES['file']['tmp_name']);
   
    $query_1 = '
    LOAD DATA LOCAL INFILE "'.$file_location.'" IGNORE 
    INTO TABLE tcs_raw_task_sheets 
    FIELDS TERMINATED BY "," 
    LINES TERMINATED BY "\r\n" 
    IGNORE 1 LINES 
    (@column1,@column2,@column3,@column4,@column5,@column6,@column7,@column8,@column9) 
    SET MW = @column1, HT_MW = @column2,  D_MW = @column3, C_MW = @column4, QA = @column5, D_QA = @column6, C_QA = @column7, R_QA = @column8, R_EVA = @column9
    ';
   
    $statement = $connect->prepare($query_1);
   
    $statement->execute();
    if ($statement) {
          $output = array(
     'success' => 'Total <b>'.$total_row.'</b> Data imported'
    );
   
    echo json_encode($output);
?>
faheem