From the reference libraryFiveM

Update

ox/oxmysql/Functions/update.mdx

Update

Returns the number of rows affected by the query.

Promise

    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`
Back to documentation