<?php
$current = 0;
$results = 5;
$statement = $db->prepare("SELECT title, id FROM mytable LIMIT ?, ?");
$statement->execute(array($current, $results));
?>
var_dump($statement);
=> public 'queryString' => string 'SELECT title, id FROM mytable LIMIT ?, ?' (length=39)
Can anyone help me find why this isn’t working?
You need to bind those parameters as integers, and not as strings (default). Binding parameters as strings adds quotes around them automatically.
This example uses named placeholders. I recommend you used it regardless.