mirror of
https://codeberg.org/vlw/php-mysql.git
synced 2025-09-14 08:43:40 +02:00
fix(doc): change limit method in README
This commit is contained in:
parent
63baaf0793
commit
431a9a971c
1 changed files with 6 additions and 5 deletions
11
README.md
11
README.md
|
@ -260,14 +260,15 @@ Chain the `limit()` method before a `select()` statement to limit the amount of
|
||||||
|
|
||||||
```php
|
```php
|
||||||
MySQL->limit(
|
MySQL->limit(
|
||||||
int|array|null $limit
|
?int $limit,
|
||||||
|
?int $offset = null
|
||||||
): self;
|
): self;
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
> You can also flatten to a single dimensional array from the first entity by chaining [`MySQL->flatten()`](#flatten-array-to-single-dimension)
|
> You can also flatten to a single dimensional array from the first entity by chaining [`MySQL->flatten()`](#flatten-array-to-single-dimension)
|
||||||
|
|
||||||
## Passing an integer to LIMIT
|
## Passing a single integer argument
|
||||||
This will simply `LIMIT` the results returned to the integer passed
|
This will simply `LIMIT` the results returned to the integer passed
|
||||||
|
|
||||||
```php
|
```php
|
||||||
|
@ -282,11 +283,11 @@ $coffee = MySQL->for("beverages")->limit(1)->select(["beverage_name", "beverage_
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Passing an associative array to LIMIT
|
## Passing two integer arguments
|
||||||
This will `OFFSET` and `LIMIT` the results returned from the first key of the array as `OFFSET` and the value of that key as `LIMIT`
|
This will `OFFSET` and `LIMIT` the results returned. The first argument will be the `LIMIT` and the second argument will be its `OFFSET`.
|
||||||
|
|
||||||
```php
|
```php
|
||||||
$coffee = MySQL->for("beverages")->limit([3 => 2])->select(["beverage_name", "beverage_size"]); // SELECT beverage_name, beverage_size FROM beverages LIMIT 3 OFFSET 2
|
$coffee = MySQL->for("beverages")->limit(3, 2)->select(["beverage_name", "beverage_size"]); // SELECT beverage_name, beverage_size FROM beverages LIMIT 3 OFFSET 2
|
||||||
```
|
```
|
||||||
```php
|
```php
|
||||||
[
|
[
|
||||||
|
|
Loading…
Add table
Reference in a new issue