6
我有以下代碼forexample:更改PDO :: ATTR_EMULATE_PREPARES爲FALSE,並且收到「無效參數號」錯誤
$dbStatement=$this->dbObject->prepare("SELECT AVG(quality) as quality,
AVG(adequacy) as adequacy,
AVG(friendliness) as friendliness,
SUM(overall) as overall,
SUM(completed) as completed,
type
FROM (SELECT AVG(quality) as quality,
AVG(adequacy) as adequacy,
AVG(friendliness) as friendliness,
COUNT(id) as overall,
SUM(is_completed) as completed,
category_id, type
FROM valuation a
WHERE status =1
AND type =:01
AND ((type='employer' AND owner_id=:02)
OR (type='employee' AND winner_id=:02))
GROUP BY category_id
HAVING COUNT(id)<=:03) b
GROUP BY type");
$dbStatement->bindParam(':01',$Type);
$dbStatement->bindParam(':02',$UserID);
$dbStatement->bindParam(':03',$Most);
$dbStatement->execute();
此代碼當我設置PDO::ATTR_EMULATE_PREPARES
到FALSE
拋出異常。下面的消息被包括在異常對象:
SQLSTATE [HY093]:無效參數號
無法意識到問題,到目前爲止,雖然讀出的相應的手冊。
撞頭到磚牆/解決...謝謝。 –
感嘆...有時候php是無法相信的......無論如何謝謝你的回答。你是對的! – StefanNch