Reputation: 25
'SELECT * FROM table WHERE id < '$random' ORDER BY id DESC LIMIT 1'
Upvotes: 0
Views: 56
Reputation: 17139
Your concatenation is incorrect on line 9:
$db->query('SELECT * FROM table WHERE id < ' . $random . ' ORDER BY id DESC LIMIT 1');
.
is the concatenation operator in PHP.
And unless you enjoy SQL injection, I would strongly suggest escaping the POST input, unless your $db
object does this for you.
Upvotes: 4