我正在运行一个一直运行良好的脚本,最后一次运行昨天,现在我在运行它时遇到了这些错误:
常规错误:0 [IBM] psystem i访问odbc驱动程序]未定义 变量:detailCheck调用null
上的成员函数fetch()
所有人都在同一条线上:
while ($row2 = $detailCheck->fetch(PDO::FETCH_ASSOC)) {
同样,它工作正常,连接良好,表存在,查询全部手动运行。我没有做任何改变,所以我完全迷失在这里
$ordStatSql = 'SELECT order_id, order_status, is_placement, date_updated
FROM order_status
WHERE order_status = "S"
AND date_updated IS NULL';
try{
$ordStat = $MysqlConn->prepare($ordStatSql);
$result = $ordStat->execute();
}
catch(PDOException $ex)
{
echo "QUERY FAILED!: " .$ex->getMessage();
}
$order_ids = [];
while ($row = $ordStat->fetch(PDO::FETCH_ASSOC)) {
$order_ids[] = $row['order_id'];
}
if (count($order_ids) > 0) {
$placeholders = implode(',', array_fill(0, count($order_ids), '?'));
$detailStatCheck = "
SELECT
invnoc as INVOICE,
fstatc as STATUS,
cstnoc AS DEALER,
framec AS FRAME,
covr1c AS COVER,
colr1c AS COLOR ,
extd2d AS SHIPDATE,
orqtyc AS QUANTITY
FROM GPORPCFL
WHERE invnoc IN ($placeholders)
";
try {
$detailCheck = $DB2conn->prepare($detailStatCheck);
$detailRslt = $detailCheck->execute($order_ids);
$count2 = $detailCheck->fetch();
print_r($order_ids);
print_r($count2);
} catch(PDOException $ex) {
echo "QUERY FAILED!: " .$ex->getMessage();
}
//the below 'while' line is where I get the error
while ($row2 = $detailCheck->fetch(PDO::FETCH_ASSOC)) {
$values = [
":DEALER" => $row2["DEALER"],
":SHIPDATE" => $row2["SHIPDATE"],
":QUANTITY" => $row2["QUANTITY"],
":INVOICE" => $row2["INVOICE"],
":FRAME" => $row2["FRAME"],
":COVER" => $row2["COVER"],
":COLOR" => $row2["COLOR"],
];
$values2 = [
":DEALER" => $row2["DEALER"],
":FRAME" => $row2["FRAME"],
":COVER" => $row2["COVER"],
":COLOR" => $row2["COLOR"],
":INVOICE" => $row2["INVOICE"],
];