因此,以下代码一直困扰着我:
$stm = $pdo->prepare("SELECT * FROM urls WHERE account=? AND NOT deleted LIMIT ?, 4");
$stm->execute($user, ($request-1)*4);
每当我执行此查询时,它都会返回此错误:
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 ''0', 4' at line 1'
查找后似乎使用 ? 除非您使用 bindParam 指定,否则占位符会自动在其周围加上引号。有没有办法解决这个问题而不必使用 bingparam 函数?