Scalar

Returns the first column for a single row.

Example

Async

exports.oxmysql:scalar('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
    if result then
        print(result.firstname)
    end
end)
Sync
CreateThread(function()
    local result = exports.oxmysql:scalarSync('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier})
    if result then
        print(result.firstname)
    end
end)

Async

exports.oxmysql.scalar('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier], function(result) {
  if (result)
    console.log(result.firstname)
})
Sync
setImmediate(async () => {
  const result = await exports.oxmysql.scalarSync('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier]) {
  if (result)
    console.log(result.firstname)
})

Back to top