Limits and offsets
The limit()
and offset()
methods are used to specify the number of records to return and the number of records to skip, respectively.
TIP
The limit()
and offset()
methods are part of the Select
class.
The limit()
method
The limit()
method is used to specify the number of records to return.
php
$query = new QueryBuilder();
$query->select()
->from( 'users' )
->limit( 10 );
The offset()
method
The offset()
method is used to specify the number of records to skip. This method can be used only in conjunction with the limit()
method.
php
$query = new QueryBuilder();
$query->select()
->from( 'users' )
->limit( 10 )
->offset( 5 );