我有以下代码例如:
$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();
此代码从execute()
我设置PDO::ATTR_EMULATE_PREPARES
为FALSE
. 异常对象中包含以下消息:
SQLSTATE[HY093]:参数号无效
虽然阅读了相应的手册,但目前无法意识到问题所在。