pdo fetch one row at a time code example
Example: sql fetch next 10 rows pdo
// You could have your values in variables (or hardcoded)
$offset = 0;
$limit = 5;
$statement = $pdo->prepare('SELECT * FROM livro ORDER BY id OFFSET :offset ROWS FETCH NEXT :limit ROWS ONLY');
// Next you need to bind the values
$statement->bindValue(':offset', (int) $offset, PDO::PARAM_INT);
$statement->bindValue(':limit', (int) $limit, PDO::PARAM_INT);
// Now execute your statement
$statement->execute();