You are right. The query runs in its own thread, and it won't print variable directly after SQL_ThreadQuery. You need to do the comparison and print it in QueryStartup function.
Also you don't need to check twice for errors:
PHP Code:
public QueryStartup(FailState,Handle:query,Error[],Errcode,ip[],DataSize)
{
if (FailState == TQUERY_CONNECT_FAILED)
{
server_print("[%s]%s Error connecting to SQL: %s (%s)", log_time(), SERVER_PREFIX, Error, Errcode);
return;
}
if (FailState == TQUERY_QUERY_FAILED)
{
server_print("[%s]%s Error executing Query: %s (%s)", log_time(), SERVER_PREFIX, Error, Errcode);
return;
}
//CODE ...
}
-->
PHP Code:
public QueryStartup(FailState,Handle:query,Error[],Errcode,ip[],DataSize)
if(FailState){
log_amx("SQL Error: %s (%d)", Error, Errcode);
return;
}
//CODE ...
}
__________________