我尝试将多行CSV导入到SQL中,此代码仅使用少量行(例如75行)进行导入并成功但当我尝试导入多个行(例如700000行)时)在SQL中出现。
if(($handle = fopen($_FILES['file']['tmp_name'], 'r')) !== false)
{
$header = fgetcsv($handle);
while(($data = fgetcsv($handle)) !== false){
$sql = "INSERT into mansfield_barcode.dbo.".$_POST['uploadSName']." values('".implode("','", $data)."')";
$result = mssql_query($sql);
unset($data);
if(! $result ){
echo "<script type=\"text/javascript\">
alert(\"Invalid File:Please Upload CSV File.\");
window.location = \"sku.php\"
</script>";
}
}
fclose($handle);
echo "<script type=\"text/javascript\">
alert(\"CSV File has been successfully Imported.\");
window.location = \"sku.php\"
</script>";
}
答案 0 :(得分:0)
通过更改
解决了问题declare(ticks=1);
在php.ini中
感谢JDpawar