我有使用批量插入的php代码。,我运行代码并且没有错误。,问题没有这个代码的输出并且出现空白页面/屏幕..我想要做的就是让输出使用此代码的页面和数据库..
<?php
$dbh = odbc_connect(
"DRIVER={SQL Server Native Client 10.0};Server=.;Database=ECPNWEB",
"sa", "ECPAY");
if (($handle = fopen("c:\\tblmcwd.txt", "r")) !== FALSE) {
while (($data = fgetcsv($handle, 4096, "|")) !== FALSE) {
if (count($data) == 10) {
$sql = "INSERT INTO [dbo].[tblMCWD] (
[ID],
[ConsumerCode],
[ConsumerName],
[AccountStatus],
[AccountNumber],
[DueDate],
[CurrentBill],
[PreviousBill],
[TotalDiscount],
[TotalGrossAmountDue]
) VALUES (
?, ?, ?, ?, ?, ?, ?, ?, ?, ?
)";
$stmt = $dbh->prepare($sql);
$stmt->bindValue(1, $data[0]);
$stmt->bindValue(2, $data[1]);
$stmt->bindValue(3, $data[2]);
$stmt->bindValue(4, $data[3]);
$stmt->bindValue(5, $data[4]);
$stmt->bindValue(6, $data[5]);
$stmt->bindValue(7, $data[6]);
$stmt->bindValue(8, $data[7]);
$stmt->bindValue(9, $data[8]);
$stmt->bindValue(10, $data[9]);
$stmt->execute();
}
}
fclose($handle);
}
?>