Update mysql docs

This commit is contained in:
Linden committed 2022-03-04 10:08:32 +11:00
1 parent b912eec843
commit 0d2d82cfce
11 files changed
+137 -188

No files matched your search

+11 -10
View File
@@ -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 (?, ?, ?) ',