I have this piece of code which should retrieve 10 records at once from my database table:
$query = 'SELECT *
FROM shares
ORDER BY create_date DESC
LIMIT :sharesPerPage OFFSET :lowerBound';
$this->prepare($query);
$this->bind(':sharesPerPage', $sharesPerPage);
$this->bind(':lowerBound', $lowerBound);
$this->execute();
For some reason a PDO Exception is being thrown with information that I have wrong syntax around '10' OFFSET '0', which corresponds to $sharesPerPage
and $lowerBound
respectively.
I have checked everything already, but the query still evaluates to an error. What is wrong with that code?