# dbExec (Server)

> Runs an SQL statement without waiting for an answer.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Server
- **Category**: Database
- **URL**: https://wiki.mymp.gg/en/dbExec

## Syntax

```lua
bool dbExec(element connection, string sql, any ...)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `connection` | `element` | A connection from `dbConnect`. |
| `sql` | `string` | The SQL statement, with `?` and `??` as placeholders. |
| `...` | `any` | The placeholders' values: strings, numbers, booleans or `nil`. |

## Returns

`true` once the statement is sent. If it fails later, the error goes to the server log.

### Placeholders

- `?` takes the next value, escaped: `nil` becomes `NULL`, booleans become `1` or `0` and strings are quoted.
- `??` takes a string as an escaped table or column identifier.
- The number of values must match the number of placeholders.

## Example

```lua
dbExec(db, "UPDATE players SET money = ? WHERE account = ?", 500, accountId)
```

## See also

- [dbQuery (Server)](https://wiki.mymp.gg/en/dbQuery.md): Sends an SQL query whose answer is read later with dbPoll.
- [dbPrepareString (Server)](https://wiki.mymp.gg/en/dbPrepareString.md): Fills an SQL's placeholders with escaped values, without running it.
- [dbConnect (Server)](https://wiki.mymp.gg/en/dbConnect.md): Opens a connection to an SQLite or MySQL database. Queries run on the connection's own thread.
