title: Using LOAD DATA INFILE to upload csv into mysql table
body: <p>I'm using LOAD DATA INFILE to upload a .csv into a table. </p>
  
  <p>This is the table I have created in my db:</p>
  
  <pre><code>CREATE TABLE expenses (entry_id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(entry_id), 
  ss_id INT, user_id INT, cost FLOAT, context VARCHAR(100), date_created DATE);
  </code></pre>
  
  <p>This is some of the sample data I'm trying to upload (some of the rows have data for every column, some are missing the date column):</p>
  
  <pre>
  1,1,20,Sandwiches after hike,
  1,1,45,Dinner at Yama,
  1,2,40,Dinner at Murphys,
  1,1,40.81,Dinner at Yama,
  1,2,1294.76,Flight to Taiwan,1/17/2011
  1,2,118.78,Grand Hyatt @ Seoul,1/22/2011
  1,1,268.12,Seoul cash withdrawal,1/8/2011
  </pre>
  
  <p>Here is the LOAD DATA command which I can't get to work:</p>
  
  <pre><code>LOAD DATA INFILE '/tmp/expense_upload.csv'
  INTO TABLE expenses (ss_id, user_id, cost, context, date)
  ;
  </code></pre>
  
  <p>This command completes, uploads the correct number of rows into the table but every field is NULL. Anytime I try to add FIELDS ENCLOSED BY ',' or LINES TERMINATED BY '\r\n' I get a syntax error. </p>
  
  <p>Other things to note: the csv was created in MS Excel. </p>
  
  <p>If anyone has tips or can point me in the right direction it would be much appreciated!</p>