Files
overextended.github.io/docs/oxmysql/Usage/single.md
T
2023-05-23 02:16:59 +10:00

999 B

Single

Returns the columns for a single row.

Lua

Callback

-- alias: exports.oxmysql:single

MySQL.single('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(row)
    if row then
        print(row.identifier, row.firstname, row.lastname)
    end
end)

Promise

-- alias: exports.oxmysql:single_async

local row = MySQL.single.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
if row then
    print(row.identifier, row.firstname, row.lastname)
end

JavaScript

Callback

// alias: exports.oxmysql.single

MySQL.single('SELECT * FROM users WHERE identifier = ?', [playerIdentifier],(row) => {
  if (row) {
    console.log(row.identifier, row.firstname, row.lastname)
  }
})

Promise

// alias: exports.oxmysql.single_async

const row = await MySQL.single('SELECT * FROM users WHERE identifier = ?', [playerIdentifier])
if (row) {
  console.log(row.identifier, row.firstname, row.lastname)
}