php - Issues with importing CSV file into MySQL when comma in address -
I am using a script that I found online to import the CSV file into MySQL. But when the script detects a comma in I have seen a solution where you can save from Excel to the Tab Delimited Test file. Then you go to Notepad and change the tab with a semicolon. Is this the best practice for "fixing a comma in the address"? My final goal is to take a CRV file from the highway, which is in our MySQL database from our hundreds of clients, then update every two months so that it is a good script, but am I seeing it wrong Am I Edit: It appears that the part of the PHP code that divides cells is - FIELDS Contact Try using the statement with the option '\'. my address, CO 80113 in a cell, it is also divided as there.
while ($ data = fgetcsv ( $ Handle, 1000, ",", "'")); If you use commas as comma separator, you should quote all string field values,
1, 'My address, CO80113' 2, 'his address, CO 80114' 4, 'his address, CO 80115' and so on < / Code>
Comments
Post a Comment