ertlflorian1 Posted July 20, 2013 Share Posted July 20, 2013 (edited) I have a problem function existsBetaKey (key) local query = dbQuery ( handler, "SELECT * FROM betakeys WHERE Key=?",key ) result , numrows, errmsg = dbPoll (query, -1) local row = result[1] if row then return true else return false end end db.log error: 2013-07-20 16:06:46.840: [script] FAIL: (1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Key ='8201-2349-3772-3253'' at line 1 [Query:SELECT * FROM betakeys WHERE Key ='8201-2349-3772-3253'] console error: [2013-07-20 16:06:46] WARNING: prox\beta\beta_s.lua:37: dbPoll failed; You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Key ='8201-2349-3772-3253'' at line 1 [2013-07-20 16:06:46] ERROR: prox\beta\beta_s.lua:38: attempt to index global 'result' (a boolean value) db: Edited July 20, 2013 by Guest Link to comment
novo Posted July 20, 2013 Share Posted July 20, 2013 I don't see any problem in your code, I don't think that the problem will be fixed with this code but you can always try: function existsBetaKey (key) local query = dbQuery ( handler, "SELECT * FROM betakeys WHERE Key = ?", tostring(key)) result , numrows, errmsg = dbPoll (query, -1) local row = result[1] if row then return true else return false end end Link to comment
ertlflorian1 Posted July 20, 2013 Author Share Posted July 20, 2013 Also same problem Link to comment
ertlflorian1 Posted July 20, 2013 Author Share Posted July 20, 2013 Ok i had found the problem I renamed the row Key in the Database and now it works! Link to comment
Castillo Posted July 20, 2013 Share Posted July 20, 2013 "Key" must be a MySQL reserved name. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now