mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-08-29 01:08:59 +00:00
923 B
923 B
query
SELECT returns all matching rows (array of rows). Other statements return insertId, affectedRows, etc.
Lua (Promise)
local response = MySQL.query.await('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ?', { identifier })
if response then
for i = 1, #response do
local row = response[i]
print(row.firstname, row.lastname)
end
end
Lua (Callback)
MySQL.query('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ?', { identifier }, function(response)
if response then
for i = 1, #response do
local row = response[i]
print(row.firstname, row.lastname)
end
end
end)
JavaScript
const rows = await MySQL.query('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ?', [identifier]);
// rows is array of objects
Reference: query – coxdocs.dev.