title: MySQL "LOAD LOCAL DATA INFILE"
body: <p>I have hit a problem and i cant seem to get over it. I am taking information from a text file(two columns 29.12 23.42 for example separated by a space), using <code>LOAD LOCAL DATA INFILE</code>. Initially this was working with only one column in MySQL, however i have had to add an <code>ID AUTO INCREMENT</code> so i can use the most recent entry, in addition i want to now store the other column in my Database. Here is my code, its probably pretty obvious but I can't seem to find it:</p>
  
  <pre><code>&lt;?PHP
  $username = "root";
  $password = "";
  $hostname = "localhost";
  $table = "Received_Data";
  
  // Connect to Database and Table
  
  $dbhandle = mysql_connect($hostname, $username, $password)
      or die("Unable to connect to MySQL");
  echo "Connected to MySQL&lt;br&gt;";
  
  $selectdatabase = mysql_select_db("IWEMSData",$dbhandle)
      or die("Could not select IWEMSData");
  echo "Connected to IWEMSData&lt;br&gt;";
  
  // Clear Current Table and ReCreate
  
  $dt = /*"UPDATE Received_Data SET PotVal = ''";*/ "DROP TABLE Received_Data";
  mysql_query($dt);
  
  $ctb = "CREATE TABLE Received_Data
  (
  Current DECIMAL(30,2) NOT NULL,
  PotVal DECIMAL(30,2) NOT NULL, 
  
  ID BIGINT NOT NULL AUTO_INCREMENT,
  PRIMARY KEY(ID,PotVal,Current)
  )";
  
  mysql_query($ctb, $dbhandle);
  
  echo "Received_Data Table has been created";
  
  // Text File to read in
  
  $Textfile = 'IWEMSData.txt';
  
  mysql_query('
  
  LOAD DATA LOCAL INFILE "IWEMSData.txt" 
  REPLACE INTO TABLE Received_Data 
  FIELDS TERMINATED BY "" 
  LINES TERMINATED BY "\\r\\n
  (PotVal, Current)
  ";')
  
  or die('Error Loading Data File.&lt;br&gt;' . mysql_error());
  
  // Close Database connection when complete
  
  mysql_close($dbhandle);
  ?&gt;
  </code></pre>
  
  <p>So what i want is Column 1 is ID which will AUTO INCREMENT upon each entry. The second row is PotVal and the third row is Current. Then i want to only store in the second and third column.</p>
  
  <p>The problem i am getting is that ID and Current are displaying the incorrect values and i can only seem to get one row.</p>
  
  <p>Thanks in advance!</p>