Files
overextended.github.io/pages/oxmysql/Functions/update.mdx
T
2023-06-04 15:15:21 +02:00

75 lines
1.2 KiB
Plaintext

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