Files
overextended.github.io/docs/oxmysql/Usage/scalar.md
T
2022-07-07 15:02:15 +10:00

857 B

Scalar

Returns the first column for a single row.

Lua

Callback

-- alias: exports.oxmysql:scalar
-- alias: MySQL.Async.fetchScalar

MySQL.scalar('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier}, function(firstname)
    print(firstname)
end)

Promise

-- alias: exports.oxmysql:scalar_async
-- alias: MySQL.Sync.fetchScalar

local firstname = MySQL.scalar.await('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier})
print(firstname)

JavaScript

Callback

exports.oxmysql.scalar('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier], (firstname) => {
  console.log(firstname)
})

Promise

const firstname = await exports.oxmysql.scalar_async('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier])
console.log(firstname)