I am a little confused on how to use this within lua, I know regular mysql but I havn't used lua in a very long time and I am having trouble.
Could someone post a quick example on how to check if a users steamid is in a table called users and if not insert it?
I have been messing around with it and can only get it to return true.
[lua]
//It seemed to remove STEAM from the steamid?
local Check, succ, error = mysql.query(db, "SELECT * FROM users WHERE steamid=" .. "STEAM" .. tostring(ply:SteamID()) .."");
if (not succ) then Msg(error .. "\n") end
if (Check) then Msg("User STEAM" .. tostring(ply:SteamID()) .." is in table.") end
[/lua]
[lua]
local Check, succ, error = mysql.query(db, "SELECT * FROM users WHERE steamid='" .. ply:SteamID() .. "'");
if (not succ) then Msg(error .. "\n") end
if (Check) then Msg("User STEAM" .. tostring(ply:SteamID()) .." is in table.") end
[/lua]
Also make sure to require the mysql module.
Sorry, you need to Log In to post a reply to this thread.