AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   MySql Query Fails (https://forums.alliedmods.net/showthread.php?t=173781)

Stylaa 12-10-2011 12:02

MySql Query Fails
 
Whit this Code Return is always 1 if the query succeeds.

GetID() is always 1, but in the DB this SteamID is whit id 7

Maybe some1 knows the mistake i have in my code :)
PHP Code:

public GetID()
{
new 
szTempQuery[512]
        
format(szTempQuery,charsmax(szTempQuery),"SELECT id FROM `stats` WHERE (steamid = 'STEAM_0:1:23456789')")
        return 
ACH_QueryszTempQuery )


PHP Code:


public ACH_QueryszTemp[512] )
    {
        new 
result
        result 
SQL_ThreadQuery(g_Achievement_SqlTuple,"ACH_Query_Handler",szTemp)
        
log_amx("Query Debug : Query Result =  %d !!"result)
        return 
result
    
}
    public 
ACH_Query_Handler(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
    {
        if(
FailState == TQUERY_CONNECT_FAILED)
        {
            
log_amx("Load - Could not connect to SQL database.  [%d] %s"ErrcodeError)
        }
        else if(
FailState == TQUERY_QUERY_FAILED)
        {
            
log_amx("Load Query failed. [%d] %s"ErrcodeError)
        }
    
        new 
result 0
        
        
if(SQL_NumResults(Query) < 1
        {
            
//.FaiL
        
}
        else 
        {
            
// Gefunden
            
result SQL_ReadResult(Query0)
        }
        return 
result
    



xPaw 12-10-2011 13:22

Re: MySql Query Fails
 
SELECT id FROM `stats` WHERE steamid = 'STEAM_0:1:23456789'

Stylaa 12-10-2011 14:51

Re: MySql Query Fails
 
The Querys works Fine
Mine and Your Version :)

I think the Problem is in the Handler

xPaw 12-10-2011 16:03

Re: MySql Query Fails
 
Oh, well, you're doing it completely wrong. You missed the concept of threaded queries, and that is the reason why it returns 1 for you.

lucas_7_94 12-10-2011 18:50

Re: MySql Query Fails
 
Simple , you never execute the query.


All times are GMT -4. The time now is 12:07.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.