Limit
limit( int $limit )
limit( int $offset, int $limit )
The limit() method can be used to set a limit, or an offset and a limit, similar to MySQL syntax. If only one argument is provided, it will be treated as the limit, however, if two arguments are provided, the first will be treated as the offset, while the second becomes the limit (start, stop).
1 2 3 4 5 |
// Limit 10
DB::MySQL()->table('myTable')->select()->limit(10); // Offset of 20, limit of 10
DB::MySQL()->table('myTable')->select()->limit(20, 10); |
To remove a limit, you can use limit(false) or the removeLimit() method.
removeLimit( void )
1 2 3 4 5 |
// Offset of 20, limit of 10
$stmt = DB::MySQL()->table('myTable')->select()->limit(20, 10); // No Limit
$stmt->removeLimit(); |