I am uploading csv file contents into mysql database. I am not sure which approach is best & efficient & nice.
1] Using the LOAD DATA INFILE SQL statement
LOAD DATA LOCAL INFILE '/importfile.csv'
INTO TABLE test_table
FIELDS TERMINATED BY ','
LINES TERMINATED BY '
'
(field1, filed2, field3);
2] Using a script to parse and import the file for e.g. fgetcsv() function in php