fetchScalar

Returns the first column for a single row.

Example

Callback

MySQL.Async.fetchScalar('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier}, function(firstname)
    print(firstname)
end)
Promise
CreateThread(function()
    local firstname = MySQL.Async.fetchScalar('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier})
    print(firstname)
end)

Callback

exports.oxmysql.scalar_callback('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier], function(firstname) {
    console.log(firstname)
})
Promise
(async () => {
  const firstname = await exports.oxmysql.scalar_async('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier]) {
    console.log(firstname)
})()

Back to top