0
我已經從過濾器PARAM以下查詢:的毗連查詢在PHP與MySQL(PDO對象)
select * from table WHERE x= :x '{$this->getQuery()}'
function getQuery()
{
$query = "";
if ($this->y != "")
$query ="and y =:y";
return $query;
}
但有時當我從「Y」空PARAMS從我刪除行「和y的請求=:y「和查詢將是:
select * from table WHERE x= :x
問題是,即時通訊使用。 PDO->綁定(:Y) 當查詢爲空綁定不工作,並拋出以下錯誤:
Invalid parameter number: number of bound variables does not match number of tokens