Call the correct function for UPDATE

This commit is contained in:
Linden committed 2021-10-27 08:13:52 +11:00
1 parent db9b1ffb7d
commit 89e41be3c0
1 file changed
+4 -4
+4 -4
View File
@@ -7,7 +7,7 @@ Updates an entry in the database and returns the number of affected rows.
=== "Lua" === "Lua"
**Async** **Async**
```lua ```lua
exports.oxmysql:insert('UPDATE users SET firstname = ? WHERE identifier = ? ', {newName, playerIdentifier}, function(affectedRows) exports.oxmysql:update('UPDATE users SET firstname = ? WHERE identifier = ? ', {newName, playerIdentifier}, function(affectedRows)
if affectedRows then if affectedRows then
print(affectedRows) print(affectedRows)
end end
@@ -16,7 +16,7 @@ Updates an entry in the database and returns the number of affected rows.
**Sync** **Sync**
```lua ```lua
CreateThread(function() CreateThread(function()
local id = exports.oxmysql:insertSync('UPDATE users SET firstname = ? WHERE identifier = ? ', {newName, playerIdentifier}) local id = exports.oxmysql:updateSync('UPDATE users SET firstname = ? WHERE identifier = ? ', {newName, playerIdentifier})
if affectedRows then if affectedRows then
print(affectedRows) print(affectedRows)
end end
@@ -25,7 +25,7 @@ Updates an entry in the database and returns the number of affected rows.
=== "JavaScript" === "JavaScript"
**Async** **Async**
```js ```js
exports.oxmysql.insert('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, playerIdentifier], function(affectedRows) { exports.oxmysql.update('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, playerIdentifier], function(affectedRows) {
if (affectedRows) if (affectedRows)
console.log(affectedRows) console.log(affectedRows)
}) })
@@ -33,7 +33,7 @@ Updates an entry in the database and returns the number of affected rows.
**Sync** **Sync**
```js ```js
setImmediate(async () => { setImmediate(async () => {
const id = exports.oxmysql.insertSync('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, playerIdentifier]) { const id = exports.oxmysql.updateSync('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, playerIdentifier]) {
if (affectedRows) if (affectedRows)
console.log(affectedRows) console.log(affectedRows)
}) })