Ive got a simple gamemode up and running and ive got a simple system where if a player joins, Their Nick, SteamID and IP are inserted into the database.
What I would like to know is how I would count how many rows were returned in a query.
This is my current code
function GM:PlayerInitialSpawn ( ply ) tmysql.initialize( "x", "x", "x", "x", 3306) tmysql.query("SELECT ALL FROM users WHERE sid = '" .. ply:SteamID() .. "'") tmysql.query("INSERT INTO `users` (`sid`, `name`, `ip`) VALUES ('" .. ply:SteamID() .. "', '" .. ply:Nick() .. "', '" .. ply:IPAddress() .. "')") self.BaseClass:PlayerInitialSpawn( ply ) if ply:IsAdmin() then ply:PrintMessage(HUD_PRINTTALK, "Welcome to the server.") else ply:PrintMessage(HUD_PRINTTALK, "Welcome to the server.") end end
What I want it to do is see if there is already a row with there steamid and if there is, dont do anything. But if there isnt then create one, if that makes sense.