I was recently working on a php script to import csv file data into a MySQL table. I was getting odd results in my table, and it appeared to me that the script was not respecting the line endings in the csv file.
After trying a lot of different solutions I found some information regarding the
ini_set
command in php. The information indicated that fgetcsv fails to detect line endings in macintosh created csv files. I found documentation on php.net that talked about this issue. The solution is to add the following line above your
fopen()
command.
ini_set('auto_detect_line_endings', true);