> For the complete documentation index, see [llms.txt](https://sprnva.gitbook.io/sprnva-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sprnva.gitbook.io/sprnva-docs/database/paginate.md).

# Paginate

Simple pagination

In  controllers:

```php
public function index()
{
    $pageTitle = "Users";
    $users = DB()->selectLoop("*", "tbl_users", "user_id > 0")
        ->paginate(20)
        ->get();

    return view('/user/index', compact('pageTitle', 'users'));
}
```

In  views:\
note:  put this where you want the pagination links will display.

```php
<?= DB()->links(); ?>
```

<figure><img src="https://3925775436-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiqBj2SDpBigv8FLYJlUy%2Fuploads%2FAPRsoIgReCJVhtxBXQuq%2Fimage.png?alt=media&amp;token=3acdf52c-ca66-4830-9e5d-658e8b0d448f" alt=""><figcaption></figcaption></figure>
