update

Returns the number of affected rows when executing an UPDATE or DELETE query.

Example

Callback

MySQL.Async.update('UPDATE users SET firstname = ? WHERE identifier = ? ', {newName, playerIdentifier}, function(affectedRows)
    if affectedRows then
        print(affectedRows)
    end
end)
Promise
CreateThread(function()
    local id = MySQL.Sync.update('UPDATE users SET firstname = ? WHERE identifier = ? ', {newName, playerIdentifier})
    if affectedRows then
        print(affectedRows)
    end
end)

Callback

exports.oxmysql.update_callback('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, playerIdentifier], function(affectedRows) {
  if (affectedRows)
    console.log(affectedRows)
})
Promise
setImmediate(async () => {
  const id = exports.oxmysql.update_async('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, playerIdentifier]) {
  if (affectedRows)
    console.log(affectedRows)
})

Back to top