mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 14:38:50 +00:00
1.0 KiB
1.0 KiB
Single
Returns the columns for a single row.
Lua
Callback
-- alias: exports.oxmysql:single
-- alias: MySQL.Async.fetchSingle
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
-- alias: MySQL.Sync.fetchSingle
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)
}