Evolve SourceBans And Admin UserIDs (MySQL - OO)

I’m trying to make it so when someone’s banned with evolve, it will not only ban them on SourceBans, but it will ban them using the admins’ IDs as well. I have modified Evolve’s SourceBans script to try and do that, but for some reason, the aid value is a table… This is what I have:

[lua]
function doBan(steamID, ip, name, length, reason, admin, callback)
local query2 = database:query((“SELECT aid FROM %s_admins WHERE authid = ‘%s’”):format(config.dbprefix, admin:SteamID()));
query2:start();
TheAdminID = query2:getData();
local time = os.time();
local adminIP = string.Explode(":", admin:IPAddress())
name = name or “”;
callback = callback or blankCallback;
local query = database:query(queries[“Ban Player”]:format(config.dbprefix, ip, steamID, database:escape(name), time, time + length, length, database:escape(reason), TheAdminID, adminIP[1], config.serverid));
query.onSuccess = banOnSuccess;
query.onFailure = banOnFailure;
query.callback = callback;
query.name = name;
query:start();
if (steamID ~= “”) then
kickid(steamID);
end
end[/lua]
Here is [“Ban Player”]:
[lua][“Ban Player”] = “INSERT INTO %s_bans (ip, authid, name, created, ends, length, reason, aid, adminIp, sid, country) VALUES(’%s’, ‘%s’, ‘%s’, %i, %i, %i, ‘%s’, %i, ‘%s’, %i, ’ ')”;[/lua]
And here is the error that I’m getting:


[@addons\evolve\lua\includes\modules\sourcebans.lua:215] bad argument #9 to 'format' (number expected, got table)

Can you tell me why I’m getting this error, and it’s not banning the player? The thing needs to remain as %i because it’s just a small integer that contains no letters or anything, and other than that, it’s pretty much self explanatory if you know how to fix it.

Here is a screenshot of what the sb_admins table looks like (yes, I do have config.dbprefix set to sb. Everything works when I remove the code and set it back to how it was originally, but it doesn’t ban using the admins aid.):

http://img209.imageshack.us/img209/7568/adminse.jpg

I tried turning the local query2 into string:format(blah, blah) (the way it shows how to do it on the wiki), but that didn’t work either.