-1
我遇到了PDO問題,我已經看到過,但提供的不同解決方案對我無效。綁定數字以設置SQL查詢的LIMIT時。使用PHP綁定PDO查詢的限制數
這裏是我的錯誤:
Warning: PDOStatement::execute(): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2'' at line 1 in ...
代碼:
$remaining = 3 - $countRows;
$con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$result4 = $con->prepare("SELECT * FROM item_descr WHERE id_item != ? LIMIT ?");
$result4->execute(array($itemId, intval($remaining)));
這不起作用:致命錯誤:調用一個成員函數bindParam()在非中的對象 – samyb8