You have an error in your SQL syntax
A script sent the database a request it could not understand.
Do this first
This is a mistake in the script. Report it to whoever wrote it, with this line.
What it means
MySQL rejected the statement. The message quotes the text starting at the point it gave up, which is the single most useful part: whatever is quoted, the problem is at or just before it.
What causes it
Ordered by how often it is the answer.
- 1
String interpolation instead of parameters
Building SQL with
..and a value that contains a quote. This is also an SQL injection hole, so it is worth fixing for two reasons. - 2
A reserved word used as a column name
rank,groups,key,order,read. MySQL 8 addedrankas a reserved word, which broke a lot of older FiveM schemas overnight. - 3
A trailing comma
SELECT a, b, FROM users— usually left behind after deleting a column from the list. - 4
A placeholder count mismatch
More
?than values, or a named parameter that was never supplied. Some drivers report this as a syntax error rather than a binding error. - 5
Multiple statements in one query
oxmysql will not run two statements separated by
;in one call unless the driver is configured for it.
How to tell which one is yours
Read the quoted fragment in the error. Then print the final SQL and run it by hand in a MySQL client — if it fails there identically, it is the statement; if it succeeds, it is the parameters.
Where to look
The query string in the resource, and the values being bound.
How to fix it
Always use placeholders. It fixes the syntax problem and the injection problem at the same time:
-- wrong
MySQL.query('SELECT * FROM users WHERE name = "' .. name .. '"')
-- right
MySQL.query('SELECT * FROM users WHERE name = ?', { name })Backtick reserved words:
SELECT `rank` FROM users WHERE identifier = ?
Still stuck on your own code?
This page is what this error usually means. Paste your console into Server Fixer and it will rank everything in it and tell you what to do first, and if you would rather not touch it, ORBIE can repair the script and hand the resource back ready to drop in.
bug_reportOpen Server Fixer