Ciao kush benvenuto al forum.
Con il cursore che risultato ottieni se supportato da driven_option?
function readDataForwards($dbh) {
// $pd_id here
$sql = 'SELECT pd_image FROM pd_images WHERE pd_id = ?';
try {
$stmt = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
$stnt->bindParam(1, $pd_id);
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT)) {
$data = $row["pd_image"] . "\n";
print $data;
}
$stmt = null;
}
catch (PDOException $e) {
print $e->getMessage();
}
}
For most databases, PDOStatement::rowCount() does not return the number of rows affected by a SELECT statement. Instead, use PDO::query() to issue a SELECT COUNT(*) statement with the same predicates as your intended SELECT statement, then use PDOStatement::fetchColumn() to retrieve the number of matching rows. Codice portatile.