SQL integers

Hi i get the error:

Timer Error: gamemode\playerdata.lua:XX: attempt to compare number with string

XX being the line where in the code below, I do curpay > 0

These are the SQL queries ran to create and read the tables/values. as far as I can see, they are Integers not strings.

sql.Query ( “CREATE TABLE player_info ( unique_id varchar(255), money int, wage int)” )

sql.Query( “INSERT INTO player_info (unique_id, money, wage)VALUES (’”…steamID…"’, ‘1000’, ‘45’)" ) --set default values

[lua]

for k,v in pairs( player.GetAll() ) do

		local steamID = v:SteamID()
		local curmoney = sql.QueryValue( "SELECT money FROM player_info WHERE unique_id = '"..steamID.."'" )
		local curpay = sql.QueryValue( "SELECT wage FROM player_info WHERE unique_id = '"..steamID.."'" )
		local newamt = curmoney + curpay
		sql.Query("UPDATE player_info SET money = "..newamt.." WHERE unique_id = '"..steamID.."'")
		v:SetNWInt("money", newamt)

		if curpay > 0 then
			v:PrintMessage( HUD_PRINTTALK, "You received: $"..curpay..".

" )
else
v:PrintMessage( HUD_PRINTTALK, "You did not receive a salary because your wage is 0.
" )
end

	end

[/lua]

SteamIDs contain colons.

local curpay = sql.QueryValue( "SELECT wage FROM player_info

unique_id varchar(255), money int, wage int)" )

[editline]06:18PM[/editline]

in other words the SteamID gets saved under the field “unique_id” and the number im trying to do math on is a different field

Like Unib5 said a SteamID has colons in it, either clean it or use UniqueID

can you read my post please -_- im not doing math on the steamID. I’m doing math on something completely different.

Sorry I’m not really good with SQL. :smiley: Just out of curiosity if you go look at the SQL table what does unique_id look like?

who gives a shit?
SQL always returns strings
use tonumber(result) to make it into a number.