I am updating legacy php code which imports csv data to a mySQL database. The code includes error checking which compares the number of imported rows to the number of lines found in the import file. The problem is that a small percentage of records includes returns or line feeds enclosed within fields. MySQL will happily load the data; but, when I count() the number of lines in the source, the number is artificially inflated due to the enclosed returns & line-feeds.
At present, the code is simply patched to force the counts into an equal condition.
I am looking for a solution to more accurately count the lines in the import file, ignoring the enclosed returns and line-feeds. Any suggestion is appreciated...
imported file can be large, so also trying to avoid loading file as array...
Thanks in advance...
-Allen M.
At present, the code is simply patched to force the counts into an equal condition.
I am looking for a solution to more accurately count the lines in the import file, ignoring the enclosed returns and line-feeds. Any suggestion is appreciated...
imported file can be large, so also trying to avoid loading file as array...
Thanks in advance...
-Allen M.