Here is a snapshot of my code:
$fetchPictures = $PDO->prepare(\"SELECT *
FROM pictures
WHERE album = :albumId
ORDER BY id ASC
LIMIT :s
PDO::ATTR_EMULATE_PREPARES
gave me the
Driver does not support this function: This driver doesn't support setting attributes' error.
My workaround was to set a $limit
variable as a string, then combine it in the prepare statement as in the following example:
$limit = ' LIMIT ' . $from . ', ' . $max_results;
$stmt = $pdo->prepare( 'SELECT * FROM users WHERE company_id = :cid ORDER BY name ASC' . $limit . ';' );
try {
$stmt->execute( array( ':cid' => $company_id ) );
...
}
catch ( Exception $e ) {
...
}