Feche1320 Posted May 18, 2013 Share Posted May 18, 2013 I have this: -- Client local x, y, z = getElementPosition(veh) local rx, ry, rz = getElementRotation(veh) if getDistanceBetweenPoints3D(x, y, z, lx, ly, lz) > 2 then table.insert(recordData, {x = x, y = y, z = z, lx = lx, ly = ly, lz = lz} ) lx = x ly = y lz = z end -- Server dbExec("UPDATE recordings SET time = " ..time.. ", recording = " ..data.. " WHERE account = '" ..account.. "'") -- This line gives me the error But I get an error saying that I attempt to conectate a table data value, is there any way? thanks Link to comment
Cadu12 Posted May 18, 2013 Share Posted May 18, 2013 Any variables type? String, Text or VARCHAR: [mysql] UPDATE table SET TIME='1111' [/mysql]Int: [mysql] UPDATE table SET TIME=1111 [/mysql] Link to comment
Feche1320 Posted May 18, 2013 Author Share Posted May 18, 2013 I want to save the WHOLE table on the sqlite db dbExec(db, "CREATE TABLE IF NOT EXISTS recordings (account TEXT, time INTEGER, recording STORAGE)") Link to comment
DiSaMe Posted May 18, 2013 Share Posted May 18, 2013 Correct me if I'm wrong, but there's no data type "storage" in SQL. As for table, of course can't simply concatenate it into the string. This is not a good way to organize your database structure, anyway. But if you still want to make it like that, you can convert the table to a string and vice-versa using these functions: toJSON fromJSON And the last thing to say, do not concatenate the values directly into the query string. Pass them as separate arguments into dbExec to avoid code injection. 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