proracer Posted March 23, 2011 Share Posted March 23, 2011 Hello everyone! I have been working hard on sql based race stats.But unfornunately always when I start resource it says: "no such column: account" Here's a piece of code: function createDB ( ) executeSQLCreateTable ( 'Points', 'account STRING, points INT' ) executeSQLCreateTable ( 'Cash', 'account STRING, cash INT' ) executeSQLCreateTable ( 'Rank', 'account STRING, rank TEXT' ) executeSQLCreateTable ( 'Wins', 'account STRING, wins INT' ) executeSQLCreateTable ( 'Played', 'account STRING, played INT' ) outputChatBox ( 'Successfully created tables.' ) -- Debug String end addEventHandler ( 'onResourceStart', resourceRoot, createDB ) function clientReady ( prev, acc, autologin ) local account = getAccountName ( acc ) local playerName = getPlayerName ( source ) -- CHECK TABLES -- resultTable1 = executeSQLSelect ( 'Points', 'account', "account = '" .. account .. "'" ) resultTable2 = executeSQLSelect ( 'Cash', 'account', "account = '" .. account .. "'" ) resultTable3 = executeSQLSelect ( 'Rank', 'account', "account = '" .. account .. "'" ) resultTable4 = executeSQLSelect ( 'Wins', 'account', "account = '" .. account .. "'" ) resultTable5 = executeSQLSelect ( 'Played', 'account', "account = '" .. account .. "'" ) if (type(resultTable1) == 'table' and #resultTable1 == 0 ) or not resultTable1 then executeSQLInsert ( 'Points', "'" .. account .. "', '0'" ) end if (type(resultTable2) == 'table' and #resultTable2 == 0 ) or not resultTable2 then executeSQLInsert ( 'Cash', "'" .. account .. "', '0'" ) end if (type(resultTable3) == 'table' and #resultTable3 == 0 ) or not resultTable3 then executeSQLInsert ( 'Rank', "'" .. account .. "', 'None'" ) end if (type(resultTable4) == 'table' and #resultTable4 == 0 ) or not resultTable4 then executeSQLInsert ( 'Wins', "'" .. account .. "', '0'" ) end if (type(resultTable5) == 'table' and #resultTable5 == 0 ) or not resultTable5 then executeSQLInsert ( 'Played', "'" .. account .. "', '0'" ) end outputChatBox ( " I'm ready! " ) -- Debug String end addEventHandler ( 'onPlayerLogin', root, clientReady ) Line 16 error: Database query failed: no such column: account But surprisingly it only says that it can't find column 'account' for table: 'Points'.So there is a little hint and I hope you can help me.. But it still outputs to chatbox the last string for debug. Link to comment
Martyz Posted March 24, 2011 Share Posted March 24, 2011 First use this module: https://wiki.multitheftauto.com/wiki/Mysql And do you even have MySQL database? Link to comment
proracer Posted March 24, 2011 Author Share Posted March 24, 2011 Well .. Nevermind now, I use XML files now .. lot easier. I installed that module but its more complicated and gives me errors pretty often so nevermind .. now, thx anyway! Link to comment
#Paper Posted March 24, 2011 Share Posted March 24, 2011 Must you set stats for an account? Use setAccountData and getAccountData, not execute... it's more easy Link to comment
proracer Posted March 24, 2011 Author Share Posted March 24, 2011 I know that way, but its too way simple and you cant view stats like in XML or SQL. Link to comment
#Paper Posted March 24, 2011 Share Posted March 24, 2011 you can't see it in game or out the game? Link to comment
Martyz Posted March 24, 2011 Share Posted March 24, 2011 I can help you to make it with that module if you want. Link to comment
#Paper Posted March 24, 2011 Share Posted March 24, 2011 Out the game. The stats whit these functions are saved in registry.db (server path) and u can see it whit SQLLite Browser ;D Link to comment
Castillo Posted March 24, 2011 Share Posted March 24, 2011 First use this module: https://wiki.multitheftauto.com/wiki/MysqlAnd do you even have MySQL database? Don't post if you don't know of what are you talking about, he's using SQLite no Mysql, SQLite doesn't require that module. Link to comment
Martyz Posted March 25, 2011 Share Posted March 25, 2011 First use this module: https://wiki.multitheftauto.com/wiki/MysqlAnd do you even have MySQL database? Don't post if you don't know of what are you talking about, he's using SQLite no Mysql, SQLite doesn't require that module. sorry, SIR! Topic author didn't explain what SQL he wants to use - SQLite or MySQL... Link to comment
Castillo Posted March 26, 2011 Share Posted March 26, 2011 Usually when we say "SQL" we're referring to "SQLite" 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