mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 14:38:50 +00:00
1.1 KiB
1.1 KiB
Insert
Inserts a new entry into the database and returns the insert id for the row, if valid.
Lua
Callback
-- alias: exports.oxmysql:insert
-- alias: MySQL.Async.insert
-- alias: exports.ghmattimysql:execute
MySQL.insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)', {playerIdentifier, firstName, lastName}, function(id)
print(id)
end)
Promise
-- alias: exports.oxmysql:insert_async
-- alias: MySQL.Sync.insert
-- alias: exports.ghmattimysql:executeSync
local id = MySQL.insert.await('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)', {playerIdentifier, firstName, lastName})
print(id)
JavaScript
Callback
// alias: exports.oxmysql.insert
MySQL.insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)', [playerIdentifier, firstName, lastName], (id) => {
console.log(id)
})
Promise
// alias: exports.oxmysql.insert_async
const id = await MySQL.insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)', [playerIdentifier, firstName, lastName])
console.log(id)