Retrieving data from a database table and inerting it into a table.

Wonder if anybody can help me.

I’m trying to loop through each record in a database table, and retrieve all the SteamIDs and ranks (Rank is a number) and then put this information into a table. This table will have all the SteamIDs and ranks in it.

So far I have:

tmysql.query("SELECT * FROM ranks", function ( Whatever )
for k, v in pairs(Whatever) do
	local steamID = tostring(v[1]);
	local userRank = tonumber(v[2]);
	rtable[steamID] = {}
	rtable[steamID].Rank = userRank

But this doesn’t seem to work.

I don’t know if I’m doing the results part correctly, and looping through each one.

Would highly appreciate anyones help.