SQL Problems

I am trying to get my SQL function to work. Its simply not. I cannot figure out why. I have tried so many different methods of getting it to work. The SQL function takes place on the client side(This is possible right?) and its suppose to retrieve information and display it on a form…

Here is my code:


 steamID = ply:GetNWString("SteamID")
totalTags = sql.QueryValue("SELECT count(tags) FROM player_stats WHERE unique_id = '"..steamID.."'")
totalDeaths = sql.QueryValue("SELECT count(deaths) FROM player_stats WHERE unique_id = '"..steamID.."'")


Thanks,
Dizzymagoo

[lua]ply:SteamID()[/lua] ?

SQL needs to take place serverside, it CAN take place clientside, but what would you do if they just change the variables?



function LoadDat(ply)
	local totalTags = sql.QueryValue("SELECT count(tags) FROM player_stats WHERE unique_id = \'"..ply:SteamID().."\'")
	local totalDeaths = sql.QueryValue("SELECT count(deaths) FROM player_stats WHERE unique_id = \'"..ply:SteamID().."\'")
	ply:SetFrags(totalTags)
	ply:SetDeaths(totalDeaths)
end


I dunno if this is what you’re going for, but sure.