我在尝试从我的表中检索用户 ID 不等于会话 ID 的所有记录时遇到问题,并且 X 列中的值大于 Y 列的值。我想返回我的结果一个循环。
到目前为止,我的代码是...
// Select all users that arent the current session users and have a
// higher integer in bank column than that of the credits column
$stmt = $conn->prepare('SELECT * FROM users WHERE user_id!=? AND user_bank <= user_credits');
$stmt->bindParam(1, $uid, PDO::PARAM_INT);
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);
// Return all records in a loop
我怎样才能做到这一点?
错误日志
[Wed May 29 21:08:49 2013] [error] [client 89.240.62.228] PHP Fatal error: Uncaught exception 'PDOException' with message '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 ''19497918' AND user_bank <= user_credits' at line 1' in ...