SalientAnimal Posted January 20, 2017 Share Posted January 20, 2017 (edited) Hi All, I am running a PHP script on a daily basis to import data into my database. THe PHP file is executed by my Windows Services.The PHP file is a LOAD DATA IN FILE script and looks like the below: LOAD DATA LOCAL INFILE '\master_import\\myfilename.csv' IGNORE INTO TABLE mydatabase.mytable CHARACTER SET latin1 FIELDS TERMINATED BY ',' ENCLOSED BY '"' IGNORE 1 LINES ( record_number , name , action_date , location , type_of_outlet .... ) ; The ENCLOSED BY '"' is where my problem lies, as I do not know how to use the '"' without PHP reading it as a " to close the script. Any help will be appreciated. Thanks. Edited January 20, 2017 by SalientAnimal Quote Link to comment Share on other sites More sharing options...
Solution requinix Posted January 20, 2017 Solution Share Posted January 20, 2017 You don't know about backslashes? How do you not know about backslashes? echo "String with a " quote"; // nope echo "String with a \" quote"; // winner 1 Quote Link to comment Share on other sites More sharing options...
SalientAnimal Posted January 20, 2017 Author Share Posted January 20, 2017 (edited) You don't know about backslashes? How do you not know about backslashes? echo "String with a " quote"; // nope echo "String with a \" quote"; // winner Somehow with my brain working overtime and not being a seasoned php script writer I didn't even think of doing this, although I know I have done it in the past. Thanks... Edited January 20, 2017 by SalientAnimal Quote Link to comment Share on other sites More sharing options...
requinix Posted January 20, 2017 Share Posted January 20, 2017 Brain farts are an acceptable excuse. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.