No, it is not correct. Let me try to explain again using your code:
PHP Code:
new VarTest
public SqlGetUserIndex(id)
{
SQL_ThreadQuery(handle, "_SqlGetUserIndex", "SELECT id FROM users WHERE authid = 'STEAM_XXXXXXXX'") //when this finishes executing the query is not guaranteed to be completed
return VarTest //this can be executed BEFORE _SqlGetUserIndex has a chance to be called and set VarTest, it will likely return 0 or the result from a previous query
}
__________________