Answers for "sql fetch next 10 rows pdo"

SQL
0

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();
Posted by: Guest on March-23-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language