Here is a snapshot of my code:
$fetchPictures = $PDO->prepare(\"SELECT *
FROM pictures
WHERE album = :albumId
ORDER BY id ASC
LIMIT :s
Since nobody has explained why this is happening, I'm adding an answer. The reason it is behaving this was is because you are using trim()
. If you look at the PHP manual for trim
, the return type is string
. You are then trying to pass this as PDO::PARAM_INT
. A few ways to get around this are:
filter_var($integer, FILTER_VALIDATE_NUMBER_INT)
to make sure you are passing an integer.intval()
(int)
is_int()
There are plenty more ways, but this is basically the root cause.