Function
dbExec
Runs a query that returns no result (INSERT, UPDATE, CREATE). Arguments replace the ? placeholders.
Syntax
bool dbExec(element connection, string query, mixed ...)Arguments
connectionelement- A handle from
dbConnect. querystring- SQL query with
?in place of values. ...mixed- Values for the
?placeholders, safely quoted.
Returns
true if the query was accepted.
Example
local db = dbConnect("sqlite", "gracze.db")
addEventHandler("onPlayerQuit", root, function()
dbExec(db, "INSERT OR REPLACE INTO gracze (serial, kasa) VALUES (?, ?)",
getPlayerSerial(source), getPlayerMoney(source))
end)
Notes
Never build SQL from player text. Always use ? instead of .., otherwise a player can inject their own query.