Get Banned Users From MySQL

I am making a ban system that stores the bans in a mysql database and I am not sure how to put all the banned players into a table along with their ban date and then send that table to the client so it can be displayed into a dlistview. I think you use datastreams but I have never used them before. I also don’t know what to hook it to so it will send the data each time I open the dlistview so it is always up to date.

This is my database string



CheckBanned = mysql.query( db, "SELECT count(*) FROM users WHERE steamid = '" .. steam .. "' AND banned = '1';" )


Yeah, i could always put stuff into a database, but i was never clear on how to get stuff OUT :smiley: though, you could do PrintTable(CheckBanned) and try to see where that leads you…

[lua]
b = {}
function GetBannedUsers()
local t,i,e
t, i, e = mysql.query(db, “SELECT * FROM users WHERE banned = ‘1’;”)
if( t ) then
b = t or {}
else
Msg(tostring(e)…"
" or "Nothing.
")
end
end
[/lua]

Untested.