我有一个数据库,正在将一个较大的csv文件加载到其中。直到最近,下面的脚本都可以正常工作,并且我还没有对脚本本身进行任何更改,但是它突然停止了工作...
CSV文件的示例是
"Offer.ID","Offer.PhoneCost","Offer.TotalCost","Offer.MonthlyCost","Offer.FreeGift","Offer.FreeGiftImage","Offer.FreeGiftCategory","Offer.FullFreeGift","Offer.OfferCashback","Offer.AutoCashback","Offer.Clearance","Offer.OfferMins","Offer.OfferTxts","Offer.OfferRental","Offer.OfferLength","Offer.OfferText","Offer.Link"
"8676820","0.00","165.00","13.75","","","","15.00 Guaranteed Cashback","15.00","1","0","0","0","15.00","0","£15.00 Automatic Cashback","http://www.urmob.co.uk/t/a/psav89/URMOB-xmakex-xmodelx-xtariffx/track.php%253fid=8676820"
我正在使用的PHP脚本是...
<?php
require_once 'dbconnect.php';
$dbh = db_connect();
$log = fopen("database-log.txt", "w");
$time = date("Y-m-d H:i:s");
//start the log
$logstart = "------------------------------------------------\n" . $time . " log start\n------------------------------------------------\n\n";
fwrite($log, $logstart);
//clean the temp table
$query = "TRUNCATE TEMPDATA";
$trunc = mysqli_query($dbh, $query);
if($trunc){
fwrite($log, "TEMPDATA cleared\n");
} else {
fwrite($log, "TEMPDATA failed\n");
}
//load affiliate window csv
$query = "load data local infile '/home/data.csv' into table rim6jtvnox6vmwxk.TEMPDATA FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n' IGNORE 1 ROWS";
$update = mysqli_query($dbh, $query);
fwrite($log, $update);
if($update){
fwrite($log, "TEMPDATA Table updated with CSV\n");
} else {
fwrite($log, "Failed CSV update - " . mysqli_error($dbh) . "\n");
}
mysqli_close($dbh);
$endtime = date("Y-m-d H:i:s");
$logend = "\n\n------------------------------------------------\n" . $endtime . " log end\n------------------------------------------------\n";
//end the log
fwrite($log, $logend);
fclose($log);
?>
我知道与数据库的连接正在正常工作,并且可以看到数据库已清除。但是加载脚本似乎没有执行,也没有从mysqli_error
发出任何错误。
任何不起作用的想法将不胜感激。