tigerman Posted November 29, 2010 Share Posted November 29, 2010 function testing(thePlayer, command) local players = executeSQLQuery("SELECT milk FROM database") outputConsole("test:", thePlayer) for i, data in ipairs(players) do bauh = data.milk outputConsole("Blabla : " ..bauh, thePlayer) end end addCommandHandler("te", testing) executeSQLCreateTable("database", "milk INT") Ok, this should show all values that are in "milk" database, but it dont do anything, even no errors.. Link to comment
dzek (varez) Posted November 29, 2010 Share Posted November 29, 2010 did you store anything? just creating database and reading values will return nothing, as nothing is stored in DB Link to comment
tigerman Posted November 29, 2010 Author Share Posted November 29, 2010 Yes, it stores wins for players Link to comment
Aibo Posted November 29, 2010 Share Posted November 29, 2010 are you sure? :3 get some SQLite database manager (http://code.google.com/p/sqlite-manager/ for example) and check if there is anything in your database. because it looks like you've edited a wiki example from executeSQLQuery page. and no mentions here that anything was stored in your milk database. PS: better not call your table "database". it can be confusing and no way to tell to which resource it belongs. Link to comment
tigerman Posted November 29, 2010 Author Share Posted November 29, 2010 16 results in this database, so yes im sure Link to comment
dzek (varez) Posted November 29, 2010 Share Posted November 29, 2010 if you are sure it contains data then.. you are outputting it to console - are you checking the console or chatbox? it will be shown only in client console, not server. script looks fine, so if there is a data - it will output to console. if there is no data - there will be no output Link to comment
tigerman Posted November 29, 2010 Author Share Posted November 29, 2010 Im testing it on local server (windowed mode) so im checking both and still nothing Link to comment
Aibo Posted November 29, 2010 Share Posted November 29, 2010 "console" here means player console (~ or F8 key ingame), not server console. Link to comment
tigerman Posted November 29, 2010 Author Share Posted November 29, 2010 Hah, works fine in F8 ^^ thanks u both Link to comment
tigerman Posted November 29, 2010 Author Share Posted November 29, 2010 Now if i only would find out way how to sort/list them by growing like 9 8 4 3 1 etc.. then my life would be perfect Link to comment
Aibo Posted November 29, 2010 Share Posted November 29, 2010 executeSQLQuery("SELECT milk FROM database ORDER BY milk DESC") Link to comment
dzek (varez) Posted November 29, 2010 Share Posted November 29, 2010 i need to do the same: 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