Generic topic I know. Its hard to be specific in a topic. Anyway I have problem with this sql logic:
"SELECT * FROM imagecomment WHERE filename = :filename ORDER BY comment_timestamp DESC LIMIT '$min', '$max'";
When I try the same logic but with integers directly in the sql logic it works. The variables min and max are integers:
int(10) int(20) I get this when var_dump() them. I also tried to bindValue() the variables (as I usually do) to two parameters but it still didn't work.
You're using this in a PDOStatement, right? (since you're using :filename)
$db = new PDO(); //assume you have this set
$stmt = $db->prepare(
"SELECT *
FROM imagecomment
WHERE filename = :filename
ORDER BY comment_timestamp
DESC LIMIT :min, :max";
$stmt->bindValue(':filename', $filename);
$stmt->bindValue(':min', $min);
$stmt->bindValue(':max', $max);
$stmt->execute();
And you should be able to fetch your results, If that doesn't work, let me know what error you're getting back from the PDOStatement.
"SELECT * FROM imagecomment
WHERE filename = :filename ORDER BY comment_timestamp DESC LIMIT $min, $max";