SQL isn't saving the stats!!!

well title says it all heres my code
Edit: Found out its just the player_info table still need help though
[lua]

function sql_value_stats ( ply )
unique_id = sql.QueryValue(“SELECT unique_id FROM player_info WHERE unique_id = '”…steamID…"’")
money = sql.QueryValue(“SELECT money FROM player_info WHERE unique_id = '”…steamID…"’")
xp = sql.QueryValue(“SELECT xp FROM player_info WHERE unique_id = '”…steamID…"’")
level = sql.QueryValue(“SELECT level FROM player_info WHERE unique_id = '”…steamID…"’")
model = sql.QueryValue(“SELECT model FROM player_info WHERE unique_id = '”…steamID…"’")
ply:SetNWString(“unique_id”, unique_id)
ply:SetNWInt(“money”, money)
ply:SetNWInt(“xp”, xp)
ply:SetNWInt(“level”, level)
ply:SetNWString(“model”,model)
end

function sql_value_skills ( ply )
unique_id = sql.QueryValue(“SELECT unique_id FROM player_skills WHERE unique_id = '”…steamID…"’")
healing = sql.QueryValue(“SELECT healing FROM player_skills WHERE unique_id = '”…steamID…"’")
summoning = sql.QueryValue(“SELECT summoning FROM player_skills WHERE unique_id = '”…steamID…"’")
elements = sql.QueryValue(“SELECT elements FROM player_skills WHERE unique_id = '”…steamID…"’")
speed = sql.QueryValue(“SELECT speed FROM player_skills WHERE unique_id = '”…steamID…"’")
power = sql.QueryValue(“SELECT power FROM player_skills WHERE unique_id = '”…steamID…"’")
health = sql.QueryValue(“SELECT health FROM player_skills WHERE unique_id = '”…steamID…"’")
accuracy = sql.QueryValue(“SELECT accuracy FROM player_skills WHERE unique_id = '”…steamID…"’")
speedShooting = sql.QueryValue(“SELECT speedShooting FROM player_skills WHERE unique_id = '”…steamID…"’")
rangeDmg = sql.QueryValue(“SELECT rangeDmg FROM player_skills WHERE unique_id = '”…steamID…"’")

ply:SetNWString("unique_id", unique_id)
ply:SetNWInt("healing",healing)
ply:SetNWInt("summoning",summoning)
ply:SetNWInt("elements",elements)
ply:SetNWInt("speed",speed)
ply:SetNWInt("power",power)
ply:SetNWInt("health",health)
ply:SetNWInt("accuracy",accuracy)
ply:SetNWInt("speedShooting",speedShooting)
ply:SetNWInt("rangeDmg",rangeDmg)

end
–healing int, summoning int, elements int, speed int, power int,health int,accuracy int,speedShooting int, rangeDmg
function saveStat ( ply )
money = ply:GetNWInt(“money”)
unique_id = ply:GetNWString (“SteamID”)
xp = ply:GetNWInt(“xp”)
level = ply:GetNWInt(“level”)
model = ply:GetNWString(“model”)
healing = ply:GetNWInt(“healing”)
summoning = ply:GetNWInt(“summoning”)
elements = ply:GetNWInt(“elements”)
speed = ply:GetNWInt(“speed”)
power = ply:GetNWInt(“power”)
health = ply:GetNWInt(“health”)
accuracy = ply:GetNWInt(“accuracy”)
speedShooting = ply:GetNWInt(“speedShooting”)
rangeDmg = ply:GetNWInt(“rangeDmg”)

sql.Query("UPDATE player_skills SET healing = "..healing..", summoning = "..summoning..", elements = "..elements..", speed = "..speed..", power = "..power..", health = "..health..", accuracy = "..accuracy..", speedShooting = "..speedShooting..", rangeDmg = "..rangeDmg.." WHERE unique_id = '"..unique_id.."'")
sql.Query("UPDATE player_info SET money = "..money..", xp = "..xp..", level = "..level..", model = "..model.." WHERE unique_id = '"..unique_id.."'")
ply:ChatPrint("Stats updated !")
ply:ChatPrint(level)

end

function tables_exist()

if (sql.TableExists("player_info") && sql.TableExists("player_skills")) then
	Msg("Both tables already exist !")
else
	if (!sql.TableExists("player_info")) then
		query = "CREATE TABLE player_info ( unique_id varchar(255), money int,xp int,level int,model varchar(255) )"
		result = sql.Query(query)
		if (sql.TableExists("player_info")) then
			Msg("Succes ! table 1 created 

")
else
Msg("Somthing went wrong with the player_info query !
")
Msg( sql.LastError( result ) … "
" )
end
end
if (!sql.TableExists(“player_skills”)) then
query = “CREATE TABLE player_skills ( unique_id varchar(255), healing int, summoning int, elements int, speed int, power int,health int,accuracy int,speedShooting int, rangeDmg int )”
result = sql.Query(query)
if (sql.TableExists(“player_skills”)) then
Msg("Succes ! table 2 created
")
else
Msg("Somthing went wrong with the player_skills query !
")
Msg( sql.LastError( result ) … "
" )
end
end
end

end

function new_player( SteamID, ply )

	steamID = SteamID
	sql.Query( "INSERT INTO player_info (`unique_id`, `money`,`xp`,`level`,`model`)VALUES ('"..steamID.."', '100','0','1','models/player/Group03/male_07.mdl')" )
	result = sql.Query( "SELECT unique_id, money , xp , level,model FROM player_info WHERE unique_id = '"..steamID.."'" )
	if (result) then

		sql.Query( "INSERT INTO player_skills (`unique_id`, `healing` , `summoning` , `elements` , `speed` , `power` , `health` , `accuracy` , `speedShooting` , `rangeDmg` )VALUES ('"..steamID.."', '1', '1', '1','1','1','1','1','1','1')" )
		result = sql.Query( "SELECT unique_id,healing, summoning , elements , speed , power ,health ,accuracy ,speedShooting , rangeDmg FROM player_skills WHERE unique_id = '"..steamID.."'" )
		if (result) then
			Msg("Player account created !

")
sql_value_stats( ply )
sql_value_skills( ply )
else
Msg("Something went wrong with creating a players skills !
")
end

	else
		Msg("Something went wrong with creating a players info !

")
end
end

function player_exists( ply )

steamID = ply:GetNWString("SteamID")

result = sql.Query("SELECT unique_id, money , xp , level , model FROM player_info WHERE unique_id = '"..steamID.."'")
if (result) then
		sql_value_stats( ply ) // We will call this to retrieve the stats
		sql_value_skills( ply ) // We will call this to retrieve the skills
else
	new_player( steamID, ply ) // Create a new player :D
end

end

function Initialize()
tables_exist()
end

function PlayerInitialSpawn( ply )

timer.Create("Steam_id_delay", 1, 1, function()
	SteamID = ply:SteamID()
	ply:SetNWString("SteamID", SteamID)
	timer.Create("SaveStat", 10, 0, function() saveStat( ply ) end)
	player_exists( ply ) 
end)
points = (ply:GetNWInt("level")*3)-(ply:GetNWInt("healing")+ply:GetNWInt("summoning")+ply:GetNWInt("elements")+ply:GetNWInt("power")+ply:GetNWInt("speed")+ply:GetNWInt("accuracy")+ply:GetNWInt("health")+ply:GetNWInt("speedShooting")+ply:GetNWInt("rangeDmg"))
plySetNWInt("xp_left",(ply:GetNWInt("level")*100)-ply:GetNWInt("xp") )	

getSkillPoints(ply)

end
[/lua]

I’m going to hazard a guess at your problem: there’s an issue with SQL in that you can’t just throw a Lua string in there. It has to be properly escaped and whatnot. So, when inserting strings, particularly STEAMIDs, since you’re using that for your identification, we use the **[Sql.SQLStr

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Sql.SQLStr)** function when you’re inserting, updating, deleting, etc. any string. Numbers are generally ok.

You sir, are awesome. Everything works great!