0

I'm creating a script that process a .csv file and splits the data to a variable and saves it to a database but the problem goes this way,

for example my db table has 3 fields (name, qty, description) and I need them to be filled by the data from the .csv file and all the data inside the file also has a string with 3 data separated by a comma/','.

Here is the problem, what if the data inside the .csv file, in the description field has a comma/',' in it?

example: product1 , 10 , This is a test, Thanks!, then I need the data to be like this in the table

|NAME     |QTY|DESCRIPTION            |
|product1 |10 |This is a test, Thanks!|

but the problem is if that .csv file has a comma/',' in the description the script recognizes it as another field and it ruined the whole process, so is there any logical solution about this scenario?

Thanks in advance.

FYI: I get the file from vendors and they put it inside a ftp, I have no control on the file's and format they use

Les ter Bon
  • 51
  • 1
  • 8

0 Answers0