I am trying to pull admins from an external database (hosted via nfo) however I keep getting the error "Invalid query Handle 0 (error: 4)"
Error:
Code:
L 09/21/2017 - 17:01:06: [SM] Exception reported: Invalid query Handle 0 (error: 4)
L 09/21/2017 - 17:01:06: [SM] Blaming: InfiusGaming.smx
L 09/21/2017 - 17:01:06: [SM] Call stack trace:
L 09/21/2017 - 17:01:06: [SM] [0] SQL_FetchRow
L 09/21/2017 - 17:01:06: [SM] [1] Line 42, infiusgaming/admins.sp::AdminQueryCallback
Here is my callback code,
Code:
public AdminQueryCallback(Handle:owner, Handle:hndl, const String:error[], any:data)
{
if (hndl == INVALID_HANDLE) {
PrintToServer("AdminQueryCallback Error - %s - %s", error, data);
}
new client = data;
new bool:result_found = false; // Should be false
// Using Sample Data for now
new String:ply_id[MAX_COMMUNITYID_LENGTH];
GetClientAuthId(client, AuthId_SteamID64, ply_id, MAX_COMMUNITYID_LENGTH);
new String:ply_name[36];
GetClientName(client, ply_name, sizeof(ply_name));
new admin_user_id;
new String:admin_name[40] = "";
new String:admin_groups[40] = "";
if (!IsValidClient(client)) {
return false;
}
if (SQL_FetchRow(hndl)) {
result_found = true;
admin_user_id = SQL_FetchInt(hndl, 0);
SQL_FetchString(hndl, 1, admin_name, sizeof(admin_name));
SQL_FetchString(hndl, 2, admin_groups, sizeof(admin_groups));
}
else
{
PrintToServer("Failed");
}
if (result_found) {
//CENSORED
}
NotifyPostAdminCheck(client); // This function MUST be called - even if we don't give the client any admin
return false;
}
"if (SQL_FetchRow(hndl)) {" is line 44 (The line that the error trace gives.
Database connection;
Code:
ConnectDatabase()
{
SQL_TConnect(GetDatabase);
}
public GetDatabase(Handle:owner, Handle:hndl, const String:error[], any:data)
{
hDatabase = hndl;
}
I have the correct information is Databases.cfg under SourceMod/cfg/ any thoughts as to why im getting this error????