xyzii Posted January 18, 2017 Share 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 Link to comment
xyzii Posted February 5, 2017 Author Share Posted February 5, 2017 logged in as '$ ad 12-@dd' dbExec failed; (1) near "ad": syntax error Link to comment
pa3ck Posted February 5, 2017 Share Posted February 5, 2017 And your code that shows us where to problem is? Link to comment
xyzii Posted February 5, 2017 Author Share 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')") Link to comment
Snow-Man Posted February 6, 2017 Share 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)") Link to comment
3aGl3 Posted February 6, 2017 Share 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. Link to comment
xyzii Posted February 6, 2017 Author Share Posted February 6, 2017 Did it the way you told me to and it's fixed now, thanks 3aGl3! 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