title: Correct LINES TERMINATED BY when importing uploaded CSV into MySQL table from PHP
body: <p>I’m having trouble identifying how my CSV’s lines are terminated. I’m using the following PHP code to load data from a CSV into my DB.</p>
  
  <pre><code>mysql_query('LOAD DATA LOCAL INFILE "temp/test.csv"
               INTO TABLE test
               FIELDS TERMINATED BY ","
               LINES TERMINATED BY "///"
               IGNORE 1 LINES (one, two, three, four, five)');
  </code></pre>
  
  <p>Now when I use <code>LINES TERMINATED BY "///"</code>, the data is put into my DB properly, except for the fact that the 1st column on each row is “a return” followed by the cell data. That’s not what I want, I want the return to disappear.</p>
  
  <p>I think that the sequence of last column cell, <code>///</code>, return and first column cell in the CSV is split by <code>///</code> and should be split by <code>///</code> + return. I should change the <code>LINES TERMINATED BY</code>. I’ve tried <code>\n</code>, <code>\r</code>, <code>\r\n</code>, <code>\n\r</code>. After a while I tried <code>&lt;br&gt;</code> and knew I needed help.</p>
  
  <p>I’m using MS Office on a Mac and saving my CSV as <code>Comma Separated Values (.csv)</code> (<a href="http://soliddev.us/temp/test.csv" rel="nofollow">sample</a>). I’ve also tried the mentioned <code>LINES TERMINATED BY</code> with <code>MS-DOS Comma Separated</code> and <code>Windows Comma Separated</code> files.</p>
  
  <p>Result of <code>SELECT HEX(one) FROM test</code> after running my query:</p>
  
  <pre><code>Array
  (
      [0] =&gt; 0D6131
  )
  Array
  (
      [0] =&gt; 0D6132
  )
  Array
  (
      [0] =&gt; 0D6133
  )
  </code></pre>