mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 22:21:48 +00:00
Update mysql docs
This commit is contained in:
1 parent
b912eec843
commit
0d2d82cfce
11 files changed
+137
-188
No files matched your search
@@ -1,12 +1,10 @@
|
||||
---
|
||||
title: insert
|
||||
---
|
||||
# Insert
|
||||
|
||||
Inserts a new entry into the database and returns the insert id for the row, if valid.
|
||||
|
||||
:::info Example
|
||||
Lua
|
||||
## Lua
|
||||
|
||||
**Callback**
|
||||
### Callback
|
||||
```lua
|
||||
-- Alias: exports.oxmysql:insert
|
||||
-- Alias: MySQL.Async.insert
|
||||
@@ -14,7 +12,8 @@ MySQL.insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?,
|
||||
print(id)
|
||||
end)
|
||||
```
|
||||
**Promise**
|
||||
|
||||
### Promise
|
||||
```lua
|
||||
-- Alias: exports.oxmysql:insert_async
|
||||
-- Alias: MySQL.Sync.insert
|
||||
@@ -23,15 +22,17 @@ local id = MySQL.insert.await('INSERT INTO users (identifier, firstname, lastnam
|
||||
print(id)
|
||||
end)
|
||||
```
|
||||
JavaScript
|
||||
|
||||
**Callback**
|
||||
## JavaScript
|
||||
|
||||
### Callback
|
||||
```js
|
||||
exports.oxmysql.insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ', [playerIdentifier, firstName, lastName], function(id) {
|
||||
console.log(id)
|
||||
})
|
||||
```
|
||||
**Promise**
|
||||
|
||||
### Promise
|
||||
```js
|
||||
(async () => {
|
||||
const id = exports.oxmysql.insert_async('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ',
|
||||
|
||||
Reference in new issue
Block a user