computermax2328 Posted October 26, 2012 Share Posted October 26, 2012 I am actually going to piggy back onto this topic. Take a look at this query that I wrote out. $sql = "LOAD DATA LOCAL INFILE '$location' INTO TABLE test FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (firstname, lastname, rank, era)"; In my database I am getting quotation marks around firstname and lastname and no value for rank and era. I am uploading a comma delimited CSV. Thanks, Quote Link to comment Share on other sites More sharing options...
MDCode Posted October 26, 2012 Share Posted October 26, 2012 I am actually going to piggy back onto this topic. Take a look at this query that I wrote out. $sql = "LOAD DATA LOCAL INFILE '$location' INTO TABLE test FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (firstname, lastname, rank, era)"; In my database I am getting quotation marks around firstname and lastname and no value for rank and era. I am uploading a comma delimited CSV. Thanks, I'm not too sure what you're question is...? Quote Link to comment Share on other sites More sharing options...
computermax2328 Posted October 26, 2012 Author Share Posted October 26, 2012 I'm not too sure what you're question is...? In my database when my comma delimited CSV is uploaded I get quotation marks around my entries ex. "John." It is suppose to upload without the quotation marks. Quote Link to comment Share on other sites More sharing options...
jcbones Posted October 26, 2012 Share Posted October 26, 2012 Load data local infile syntax. If your fields are quoted in the CSV, you should be using ENCLOSED BY also. This would make your query: $sql = "LOAD DATA LOCAL INFILE '$location' INTO TABLE test FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n' (firstname, lastname, rank, era)"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.