Imposter Posted December 9, 2012 Share Posted December 9, 2012 Hi, i need help selecting, i need to grab the row "player_name" but i cant get it working, here is my code. function onPlayerLogin(thePreviousAccount, theCurrentAccount) -- Attempt to load data local theAccountQuery = dbQuery(theHandler, "SELECT * FROM account_stats WHERE player_name=?;", getAccountName(theCurrentAccount)) local theAccountResult = dbPoll(theAccountQuery, -1) if (theAccountResult) then outputChatBox("FOUND ACCOUNT!", source) outputChatBox(theAccountResult['player_name'], source) -- Doesnt Work else outputChatBox("DATA NOT FOUND!", source) end -- Free Query dbFree(theAccountQuery) end addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin) Link to comment
Cadu12 Posted December 10, 2012 Share Posted December 10, 2012 function onPlayerLogin(thePreviousAccount, theCurrentAccount) -- Attempt to load data local theAccountQuery = dbQuery(theHandler, "SELECT * FROM account_stats WHERE player_name='?'", getAccountName(theCurrentAccount)) local theAccountResult = dbPoll(theAccountQuery, -1) if (theAccountResult) then outputChatBox("FOUND ACCOUNT!", source) outputChatBox(theAccountResult[1]['player_name'], source) -- Doesnt Work else outputChatBox("DATA NOT FOUND!", source) end -- Free Query dbFree(theAccountQuery) end addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin) Should it work, I guess. Not tested yet. 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