问题描述:

Here is the piece of code:

 $stmt1 = $conn->prepare("SELECT * FROM image_table WHERE username=:mname && status=1 ORDER BY number DESC LIMIT :min, 5");

$stmt1->bindParam(':mname', $mname);

$stmt1->bindParam(':min', $minimum, PDO::PARAM_INT);

$stmt1->execute();

This code is inside a loop that increases $minimum by 5 each time it runs starting at 0, to display all of a members images in rows of 5 columns. When I set :min manually it works but I think because it changes with each iteration, it won't display anything. Does bindParam not work with a dynamic variable?

相关阅读:
Top