Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can I import csv files into mySQL?

csv files import MySQL nbsp
0
10 Posted

How can I import csv files into mySQL?

0

look at MYSQL’s LOAD DATA INFILE command: LOAD DATA INFILE “datafile.csv” INTO TABLE mytable FIELDS TERMINATED BY ‘,’ OPTIONALLY ENCLOSED BY ‘”‘ LINES TERMINATED BY ‘n’ More information is at: http://www.mysql.com/doc/L/O/LOAD_DATA.html You can also use phpMyAdmin: http://www.phpwizard.net/projects/phpMyAdmin/ Finally, you can also simply read the csv into a variable with fgets, and dump them into a db with a sql statement like: $sql = “INSERT into table (field1, field2, field3) values($fileRow)”; Watch out for trouble with ms creating lines line field1,,,field4 which can be converted to field1,”,”,field4 with str_replace.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.