xyzii Posted January 18, 2017 Posted January 18, 2017 Hello, I have a problem with my vehicle system and logging systems that are based on account names. So when someone registers an account that has symbols like @, - etc in it, the databases give syntax errors
xyzii Posted February 5, 2017 Author Posted February 5, 2017 logged in as '$ ad 12-@dd' dbExec failed; (1) near "ad": syntax error
pa3ck Posted February 5, 2017 Posted February 5, 2017 And your code that shows us where to problem is?
xyzii Posted February 5, 2017 Author Posted February 5, 2017 con:exec("CREATE TABLE IF NOT EXISTS ´"..player.account.name.."´ ('num', 'veh', 'x', 'y', 'z', 'rot', 'bp', 'ups', 'plate', 'hp', 'fuel', 'lock', 'r', 'g', 'b', 'r2', 'g2', 'b2', 'paintjob')")
Snow-Man Posted February 6, 2017 Posted February 6, 2017 i think correct syntax of SQL creating table is like this local connection = dbConnect("sqlite", "test.db") dbExec(connection,"CREATE TABLE IF NOT EXISTS table(numberone TEXT, numbertwo TEXT)")
3aGl3 Posted February 6, 2017 Posted February 6, 2017 17 hours ago, xyzii said: con:exec("CREATE TABLE IF NOT EXISTS ´"..player.account.name.."´ ('num', 'veh', 'x', 'y', 'z', 'rot', 'bp', 'ups', 'plate', 'hp', 'fuel', 'lock', 'r', 'g', 'b', 'r2', 'g2', 'b2', 'paintjob')") The entire way you do it is the error. You shouldn't create a new table for every player that registers... Also you should never use .. to create SQL querys...like this your database is very open to SQL injections. The proper way to do it would be a table with vehicles and a column with the account name to identify the vehicle owner.
xyzii Posted February 6, 2017 Author Posted February 6, 2017 Did it the way you told me to and it's fixed now, thanks 3aGl3!
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