Don't know what im doing wrong. for some reason it gives me this as error:
Code:
L 05/21/2019 - 22:56:06: [SM] Exception reported: Current result set has no fetched rows
L 05/21/2019 - 22:56:06: [SM] Blaming: sm.smx
L 05/21/2019 - 22:56:06: [SM] Call stack trace:
L 05/21/2019 - 22:56:06: [SM] [0] SQL_FetchInt
L 05/21/2019 - 22:56:06: [SM] [1] Line 151, plugin.sp::T_LoadData
line 151 is blank and has nothing in it
Source:
PHP Code:
...
public void OnClientPutInServer(int client)
{
if(!IsFakeClient(client) && g_Database != null)
{
char query[256], steamid[32];
GetClientAuthId(client, AuthId_SteamID64, steamid, sizeof(steamid));
FormatEx(query, sizeof(query), "SELECT * FROM userliste WHERE steam_id = '%s'", steamid);
SQL_TQuery(g_Database, T_LoadData, query, GetClientUserId(client));
}
}
public void T_LoadData(Handle owner, Handle results, const char[] error, any data)
{
if(owner == null || results == null)
{
LogError("T_LoadData returned error: %s", error);
return;
}
int client = GetClientOfUserId(data);
if (client == 0)
{
return;
}
int playerRank;
int playerTwitchName;
SQL_FieldNameToNum(results, "csgorank", playerRank);
SQL_FieldNameToNum(results, "twitch_name", playerTwitchName);
if(SQL_FetchRow(results))
{
g_iRank[client] = SQL_FetchInt(results, playerRank);
int userTwitchName = SQL_FetchInt(results, playerTwitchName);
char name[32];
GetClientName(client, name, sizeof(name));
char alias[32];
Format(alias, sizeof(alias), "[%s] %s", userTwitchName, name);
SetClientName(client, alias);
}
else
{
PrintToChat(client, "Could not find you in the DB.");
return;
}
}
...
what is wrong?