0

ユーザー 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 ...
4

3 に答える 3