user3545551
user3545551

Reputation: 25

Cannot seem to find a solution for jQuery $.post

'SELECT * FROM table WHERE id < '$random' ORDER BY id DESC LIMIT 1'

Upvotes: 0

Views: 56

Answers (1)

qJake
qJake

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

Related Questions