This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

MySql Query Fails


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Stylaa
Senior Member
Join Date: Oct 2009
Location: Flensburg, Germany
Old 12-10-2011 , 12:02   MySql Query Fails
Reply With Quote #1

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
    

__________________

Some People brings Happynes by Coming
Some by Going
Stylaa is offline
Send a message via ICQ to Stylaa
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 12-10-2011 , 13:22   Re: MySql Query Fails
Reply With Quote #2

SELECT id FROM `stats` WHERE steamid = 'STEAM_0:1:23456789'
__________________

Last edited by xPaw; 12-10-2011 at 13:22.
xPaw is offline
Stylaa
Senior Member
Join Date: Oct 2009
Location: Flensburg, Germany
Old 12-10-2011 , 14:51   Re: MySql Query Fails
Reply With Quote #3

The Querys works Fine
Mine and Your Version

I think the Problem is in the Handler
__________________

Some People brings Happynes by Coming
Some by Going

Last edited by Stylaa; 12-10-2011 at 15:48.
Stylaa is offline
Send a message via ICQ to Stylaa
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 12-10-2011 , 16:03   Re: MySql Query Fails
Reply With Quote #4

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.
__________________
xPaw is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 12-10-2011 , 18:50   Re: MySql Query Fails
Reply With Quote #5

Simple , you never execute the query.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:46.


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