> For the complete documentation index, see [llms.txt](https://docs.saturncms.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.saturncms.net/1.0.0/dev/libraries-and-functions/databasemanager/dbms/sending-database-requests.md).

# Sending Database Requests

## Database Actions

A database action defines what format the function should return the data it retrieves from the database in. For more information on Database Actions please see the actions page.

{% content-ref url="/pages/xW1Okpr97rdgHybL1iMJ" %}
[Database Actions](/1.0.0/dev/libraries-and-functions/databasemanager/database-actions.md)
{% endcontent-ref %}

## Select

The Select() function allows you to select information from the database.

```php
Select(string $what, string $from, string|null $where, string $action, string|null $order = null, string|null $limit = null)
```

### Parameters

| Parameter | Type                      | Description                                                                | Example                 |
| --------- | ------------------------- | -------------------------------------------------------------------------- | ----------------------- |
| $what     | string                    | What it should select.                                                     | id                      |
| $from     | string                    | The database table (don't include the prefix, it does this automatically). | pages                   |
| $where    | string or null            | Any conditions you require.                                                | \`content\` IS NOT NULL |
| $action   | string                    | What it should do with the data.                                           | all:assoc               |
| $order    | string or null (optional) | Any specific order you'd like the data in.                                 | \`url\` DESC            |
| $limit    | string or null (optional) | Limit the amount of data being returned.                                   | 100                     |

### Example: Selecting the logged in user.

```php
use Saturn\DatabaseManager\DBMS;
$DB = new DBMS();

// Returns the first value as a JSON object.
$DB->Select('*', 'user', 'uuid = '.$_SESSION['uuid'], 'first:object');
```

## Insert

The Select() function allows you to insert information into the database.

```php
Insert(string $into, string $columns, string $values);
```

### Parameters

| Parameter | Type   | Description                                                                | Example                 |
| --------- | ------ | -------------------------------------------------------------------------- | ----------------------- |
| $into     | string | The database table (don't include the prefix, it does this automatically). | id                      |
| $columns  | string | The columns to insert data into.                                           | pages                   |
| $values   | string | The data to insert.                                                        | \`content\` IS NOT NULL |

### Example: Creating a new page.

```php
use Saturn\DatabaseManager\DBMS;
$DB = new DBMS();

$DB->Insert("pages", "`id`,`url`,`title`,`content`", "NULL, '/test', 'Test page', 'This is a test page.'");
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.saturncms.net/1.0.0/dev/libraries-and-functions/databasemanager/dbms/sending-database-requests.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
