---
title: update
---
import { Tab, Tabs } from 'nextra-theme-docs';
# Update
Returns the number of rows affected by the query.
## Promise
```lua
local affectedRows = MySQL.update.await('UPDATE users SET firstname = ? WHERE identifier = ?', {
newName, identifier
})
print(affectedRows)
```
```js
const affectedRows = await MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ?', [
newName, identifier
])
console.log(affectedRows)
```
**Aliases**
- `MySQL.Sync.execute`
- `exports.ghmattimysql.executeSync`
- `exports.oxmysql.update_async`
## Callback
```lua
MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ?', {
newName, identifier
}, function(affectedRows)
print(affectedRows)
end)
```
```js
MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ?', [
newName, identifier
], (affectedRows) => {
console.log(affectedRows)
})
```
**Aliases**
- `MySQL.Async.execute`
- `exports.ghmattimysql.execute`
- `exports.oxmysql.update`