The last .csv file is processed and loaded into myTable, but there are 30 other .csv files prior to that - the .csv files are all being read because I echoed them out to the CLI and they are printed to the screen, but I cannot resolve why ONLY the last .csv is being INSERTED into myTable? Any ideas?
最后的.csv文件被处理并加载到myTable中,但之前有30个其他.csv文件 - .csv文件都被读取了,因为我将它们回显到CLI并将它们打印到屏幕上,但是我无法解决为什么只有最后一个.csv被插入myTable?有任何想法吗?
$mysqli = new mysqli("localhost", "root", "", "mydb");
$dir = "H:/path/20130116/";
$files = "*.csv";
foreach(glob($dir.$files) as $file) {
exec("mysql -u root -e \"USE mydb; myTable; LOAD DATA INFILE '" . $file . "' INTO TABLE myTable FIELDS TERMINATED BY ',' LINES TERMINATED BY '\\n'\"; ");
}
1 个解决方案
#1
0
Upon more and more testing, removing the first call to myTable; in the MySQL line seems to have resolved the problem.
经过越来越多的测试,删除对myTable的第一次调用;在MySQL系列中似乎已经解决了这个问题。
#1
0
Upon more and more testing, removing the first call to myTable; in the MySQL line seems to have resolved the problem.
经过越来越多的测试,删除对myTable的第一次调用;在MySQL系列中似乎已经解决了这个问题。