M MY Multiplayer: Wiki
Side
Kind

dbExec

Server

Runs an SQL statement without waiting for an answer.

bool dbExec(element connection, string sql, any ...)

Parameters

NameTypeDescription
connectionelementA connection from dbConnect.
sqlstringThe SQL statement, with ? and ?? as placeholders.
...anyThe placeholders' values: strings, numbers, booleans or nil.

Returns

true once the statement is sent. If it fails later, the error goes to the server log.

Placeholders

  • ? takes the next value, escaped: nil becomes NULL, booleans become 1 or 0 and strings are quoted.
  • ?? takes a string as an escaped table or column identifier.
  • The number of values must match the number of placeholders.

Example

dbExec(db, "UPDATE players SET money = ? WHERE account = ?", 500, accountId)

See also