我需要将批量插入类别的函数或代码放入mysql数据库。我正在为我的项目使用codeigniter。
答案 0 :(得分:1)
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;
这可以直接在mysql中运行,以便从CSV导入数据