Lloyd Logan Posted January 15, 2013 Share Posted January 15, 2013 Hey, I have been struggling for ages, and i can't quite get this to work So I am looking to update the players rank when he logs in (dont ask why), the rank in located in Localhost db = newser structure(<--- I think thats what its called) = account, then it is under the players name then admin, here is what i have so far? newserv = dbConnect( "mysql", "dbname=newserv;host=127.0.0.1", "root", "" ) function makeadminn (thePlayer) executeSQLQuery("UPDATE `account` SET `**dont know what to put here`=?, WHERE `admin`=2", thePlayer) end addCommandHandler("makemeadmin", makeadminn) Link to comment
Castillo Posted January 15, 2013 Share Posted January 15, 2013 executeSQLQuery is for SQLite only, you must use dbExec instead. Link to comment
Lloyd Logan Posted January 15, 2013 Author Share Posted January 15, 2013 executeSQLQuery is for SQLite only, you must use dbExec instead. Ahh, so what would i do? dbExec( connection, "UPDATE ?? SET ??=?", tableName, columnName, columnValue I don't understand what to replace with what? Link to comment
Castillo Posted January 15, 2013 Share Posted January 15, 2013 dbExec ( connection, "UPDATE `accounts` SET `admin` = '2' WHERE `accountName` = 'Lloyd Logan" ) Link to comment
Lloyd Logan Posted January 15, 2013 Author Share Posted January 15, 2013 dbExec ( connection, "UPDATE `accounts` SET `admin` = '2' WHERE `accountName` = 'Lloyd Logan" ) Thank you so much!!! Where you have put "Lloyd Logan" how would I replace that with whoever has logged in? Like getPlayerName? Then how would I implement this into the script? Thanks Again Lloyd Link to comment
Castillo Posted January 15, 2013 Share Posted January 15, 2013 dbExec ( connection, "UPDATE `accounts` SET `admin` = '2' WHERE `accountName` = ".. name .."" ) Link to comment
Lloyd Logan Posted January 15, 2013 Author Share Posted January 15, 2013 dbExec ( connection, "UPDATE `accounts` SET `admin` = '2' WHERE `accountName` = ".. name .."" ) That simple? name = getPlayerName then the dnExec? Link to comment
Lloyd Logan Posted January 15, 2013 Author Share Posted January 15, 2013 Yes, that's right. Thanks again Castillo! 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