Hi im trying to use this query
LOAD DATA INFILE 'c:/tmp/discounts.csv' INTO TABLE discounts FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 ROWS;
in laravel as raw query but that line terminating character actually takes the query on new line and it does not work .
$upload = DB::raw("LOAD DATA INFILE '$file' INTO TABLE '$request->table' FIELDS TERMINATED by ',' LINES TERMINATED BY '\n' IGNORE 1 ROWS");
this is the error
SQLSTATE: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''teachertest' FIELDS TERMINATED by ',' LINES TERMINATED BY ' ' IGNORE 1 ROWS' at line 1