Files
JagandLuke 1d2c490b26 refactor: Add h1 headers to all pages missing it (#137)
* refactor: Add h1 headers to all pages missing it

* refactor: missed example h3

* change hooks example heading to bold text

---------

Co-authored-by: Luke <[email protected]>
2023-07-08 11:08:43 +02:00

76 lines
1.2 KiB
Plaintext

---
title: scalar
---
import { Tab, Tabs } from 'nextra-theme-docs';
# Scalar
Returns the first column for a single row.
## Promise
<Tabs items={['Lua', 'JS']}>
<Tab>
```lua
local firstName = MySQL.scalar.await('SELECT `firstname` FROM `users` WHERE `identifier` = ? LIMIT 1', {
identifier
})
print(firstName)
```
</Tab>
<Tab>
```js
const firstName = await MySQL.scalar('SELECT `firstname` FROM `users` WHERE `identifier` = ? LIMIT 1', [
identifier
])
console.log(firstName)
```
</Tab>
</Tabs>
**Aliases**
- `MySQL.Sync.fetchScalar`
- `exports.ghmattimysql.scalar`
- `exports.oxmysql.scalar_async`
## Callback
<Tabs items={['Lua', 'JS']}>
<Tab>
```lua
MySQL.scalar('SELECT `firstname` FROM `users` WHERE `identifier` = ? LIMIT 1', {
identifier
}, function(firstName)
print(firstName)
end)
```
</Tab>
<Tab>
```js
MySQL.scalar('SELECT `firstname` FROM `users` WHERE `identifier` = ? LIMIT 1', [
identifier
], (firstName) => {
console.log(firstName)
})
```
</Tab>
</Tabs>
**Aliases**
- `MySQL.Async.fetchScalar`
- `exports.ghmattimysql.scalar`
- `exports.oxmysql.scalar`