Just for future reference...
This is what I have inside my select query handler (after the error checking)
Code:
if (!SQL_MoreResults(Query)) // No more results - User not found, create them a blank entry in the table. and zero their variables
{
for (new counter=0; counter<6; counter++)
{
g_PlayerBadges[id][counter] = 0 ;
}
knifekills[id]=0
pistolkills[id]=0
sniperkills[id]=0
parakills[id]=0
totalkills[id]=0
defuses[id]=0
plants[id]=0
explosions[id]=0
format(g_Cache,511,"INSERT INTO bf2ranks VALUES('%s','0','0','0','0','0','0','0','0','0','0','0','0','0','0')",authid[id]);
SQL_ThreadQuery(g_SqlTuple,"QueryHandle",g_Cache)
return PLUGIN_CONTINUE;
}
//Player must have been found. Loop through and load the columns into the global vars
for (new counter=0; counter<6; counter++)
{
g_PlayerBadges[id][counter] = SQL_ReadResult(Query,counter)
}
knifekills[id]=SQL_ReadResult(Query,6)
pistolkills[id]=SQL_ReadResult(Query,7)
sniperkills[id]=SQL_ReadResult(Query,8)
parakills[id]=SQL_ReadResult(Query,9)
totalkills[id]=SQL_ReadResult(Query,10)
defuses[id]=SQL_ReadResult(Query,11)
plants[id]=SQL_ReadResult(Query,12)
explosions[id]=SQL_ReadResult(Query,13)