global $db_host, $db_name, $db_user, $db_pass; $db = new PDO("mysql:host=$db_host;dbname=$db_name;charset=utf8", "$db_user", "$db_pass"); $query = "LOAD DATA LOCAL INFILE 'temp/".$_GET['csv']."' INTO TABLE tickets FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n' IGNORE 1 LINES(".substr($exists, 0, -2).")"; $result = $db->query($query); echo($query); output: LOAD DATA LOCAL INFILE 'temp/Commercial part requests from inbox.csv' INTO TABLE tickets FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY ' ' IGNORE 1 LINES(CE Approval)