BriGhtx3 Posted January 26, 2012 Share Posted January 26, 2012 Hey, I have a table with playernames and wages. Now I want to put all the players in gridlist. How can I do this? I have no code, cause I dont even know how to start. I dont want a whole code, a few tips are enough €: Got it If someone has the same problem : result = mysql_query ( handler, "SELECT * FROM workers" ) if( not result) then outputDebugString("Error executing the query: (" .. mysql_errno(handler) .. ") " .. mysql_error(handler)) else if ( mysql_num_rows ( result ) > 0 ) then mitarbeiter = mysql_fetch_assoc ( result ) destinySetData(getPlayerFromName(mitarbeiter["Name"]),"firma","mclaren") destinySetData(getPlayerFromName(mitarbeiter["Name"]),"firmgehalt",mitarbeiter["Gehalt"]) destinySetData(getPlayerFromName(mitarbeiter["Name"]),"chef",mitarbeiter["chef"]) else mysql_free_result ( result ) end end Link to comment
Kenix Posted January 26, 2012 Share Posted January 26, 2012 You can use element data for storage information. Or you can trigger to client. Example Server addEventHandler( "onPlayerLogin",root, function( ) local acc = getPlayerAccount( source ) if acc and not isGuestAccount( acc ) then local result = mysql_query( connect, "SELECT * FROM workers" ) if mysql_num_rows ( result ) > 0 then while true do local row = mysql_fetch_assoc( result ) if not row then break end setElementData( source,"sql.name",row["Name"] ) end mysql_free_result( result ) else mysql_free_result( result ) end end end ) In client just use getElementData. 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