Does MySQL's LOAD DATA LOCAL INFILE not work with CSV files?
<p>I want to import a csv file into a MySQL database using LOAD DATA LOCAL INFILE. For some strange reason, it does not import every record. Out of 300 records, it only imported 165 records at random. This is my code:</p>

<pre><code>mysqli_query($GLOBALS["___mysqli_ston"], "LOAD DATA LOCAL INFILE '/path/to/my/directory/public_ftp/incoming/clubperformance.csv' INTO TABLE `my_wonderful_table` FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n' IGNORE 1 LINES(`Column1`, `Column2`, `Column3`)") or die(((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
</code></pre>

<p>There is no error message generated by the code. I am not in control of the format or structure of the csv files so if the files are flawed in some way, I would appreciate it if you could show me an alternative &amp; reliable way to import the file via PHP. Each file has got approximately 300 records &amp; I'll be importing approximately 20 files a day.</p>

<p>I'm quite sure that my database structure is ok because I successfully imported the same data into the same database after first converting the csv file into a text file. </p>

<p>Thanks for your advice.</p>