开发者

bulk insert into mysql (CSV file-Codeigniter)

开发者 https://www.devze.com 2023-02-05 14:45 出处:网络
I need function or code for bulk insert categories into mysql data开发者_StackOverflow中文版base.I am using codeigniter for my project.START TRANSACTION;

I need function or code for bulk insert categories into mysql data开发者_StackOverflow中文版base.I am using codeigniter for my project.


START TRANSACTION;

DELETE FROM `mytable`;

LOAD DATA INFILE '/var/www/something.csv'
INTO TABLE `mytable`
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY ''
LINES TERMINATED BY '\r\n'
(email, login, pass)

COMMIT;

this can be run directly in mysql to import data from a CSV

0

精彩评论

暂无评论...
验证码 换一张
取 消