FWCentral Posted May 9, 2012 Share Posted May 9, 2012 Ok im trying to create a spawn system using SQLite. Creating the table executeSQLCreateTable ( "Spawn", "name TEXT, gang TEXT, city TEXT, type TEXT, x REAL, y REAL, z REAL, wep1 INTEGER, wep2 INTEGER, wep3 INTEGER, wep4 INTEGER, wep5 INTEGER, wep6 INTEGER, skin1 INTEGER, skin2 INTEGER, skin3 INTEGER") Now is this how i would get all the results from each field of the table? GetSpawns = executeSQLSelect ( "Spawn", "*") Link to comment
Edikosh998 Posted May 9, 2012 Share Posted May 9, 2012 executeSQLQuery("SELECT * FROM Spawn") Link to comment
FWCentral Posted May 9, 2012 Author Share Posted May 9, 2012 Thanks man, How will this return the results? Link to comment
Jaysds1 Posted May 9, 2012 Share Posted May 9, 2012 Thanks man, How will this return the results? it returns the a table full with the results: https://wiki.multitheftauto.com/wiki/ExecuteSQLQuery Link to comment
FWCentral Posted May 9, 2012 Author Share Posted May 9, 2012 Thanks i managed to create the table and insert data into the table but i want to now retrieve the data from the db and I've used executeSQLQuery to get the table now how can i use that table and the things in it i don't understand Link to comment
Jaysds1 Posted May 9, 2012 Share Posted May 9, 2012 like this: { { colname1=value1, colname2=value2, ... }, { colname1=value3, colname2=value4, ... }, ... } Link to comment
FWCentral Posted May 10, 2012 Author Share Posted May 10, 2012 Yeah i know it returns like that and that's what i don't understand, I retrieve the table from the DB, Then how can i use the data? Let's say i want to output all the data through the chat box how would i do it? Link to comment
Jaysds1 Posted May 10, 2012 Share Posted May 10, 2012 here's a preview: table = executeSQLQuery("SELECT * FROM Spawn") --[[ table = { { colname1=value1, colname2=value2, ... }, { colname1=value3, colname2=value4, ... }, ... } ]] |name|gang|city|type|x|y|z|wep1|wep2|wep3|wep4|wep5|wep6|skin1|skin2|skin3| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Link to comment
FWCentral Posted May 10, 2012 Author Share Posted May 10, 2012 Thanks man that helped me a lot 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