mehdi
mehdi

Reputation: 9502

how to escape string before use in query

how to escape this string

$sql = 'LOAD DATA LOCAL INFILE "C:\\xampp\\htdocs\\test\\import-excel\\book1.csv\\" INTO TABLE exam FIELDS TERMINATED BY  "," ';

because path to file will be a variable i don't know how to escape the path before use it in query , i used phpmyadmin ( create php code ) and it's gave me escaped string so i can use that , i hope someone can tell me about what function phpmyadmin use to generate this string from orginal string

$sql = "\'LOAD DATA LOCAL INFILE \"C:\\\\xampp\\\\htdocs\\\\test\\\\import-excel\\\\book1.csv\\\\\" INTO TABLE exam FIELDS TERMINATED BY \",\" \';";

tanks

Upvotes: 0

Views: 422

Answers (1)

Related Questions