1
我最近將我的網站從OCI轉換爲PDO。PDO PDOStatement :: execute():SQLSTATE [HY000]:一般錯誤:1008 OCIStmtExecute:ORA-01008:並非所有變量都被綁定
我有這個PHP:
foreach ($bindings as $key => $value) {
if (strpos($query, $key)) {
$stmt->bindParam(":$key", $value);
echo "Bound ". $key ." => ". $value;
}
}
輸出:
Bound :globalSearch0 => %NCR%
Bound :globalSearch1 => %NCR%
Bound :globalSearch2 => %NCR%
Bound :globalSearch3 => %NCR%
Bound :globalSearch4 => %NCR%
但仍PHP輸出錯誤信息:
Warning: PDOStatement::execute(): SQLSTATE[HY000]: General error: 1008 OCIStmtExecute: ORA-01008: not all variables bound
但所有的變量都約束!我回應生成的SQL查詢,它使用5個變量,與綁定的數量相同!
我完全錯過了什麼嗎?這與我使用oci_bind_by_name
的代碼相同,而且我從來沒有遇到任何問題,但bindParam
似乎是造成這種情況的原因。