Raised This Month: $ Target: $400
 0% 

Solved [MySQL] Return function


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
wilian159
Member
Join Date: Dec 2013
Old 01-09-2022 , 12:10   Re: [MySQL] Return function
Reply With Quote #9

Quote:
Originally Posted by Bugsy View Post
No, because immediately after calling SqlGetUserIndex(), you are expecting to have the return value from the threaded query. As HamletEagle said, the query is asynchronous, meaning you can think if it as being added to a queue and executed when resources are available. You cannot expect results to be immediately available.
PHP Code:
new VarTest[33]

public 
MyFunction(id)
{
    
// Query
    
SqlGetUserIndex(id)
}

public 
SqlGetUserIndex(id)
{
    
VarTest[id] = -1
    
    
new data[1]
    
data[0] = id
    
    SQL_ThreadQuery
(handle"_SqlGetUserIndex""SELECT id FROM users WHERE authid = 'STEAM_XXXXXXXX'"datasizeof(data))
}

public 
_SqlGetUserIndex(fail_stateHandle:queryerror[], error_codedata[], data_size)
{
    
// check fails, etc....
    
    
new id data[0]
    
    if(
SQL_NumResults(query))
    {
        
VarTest[id] = SQL_ReadResult(xQuery0)
    }
    else
    {
        
VarTest[id] = -1
        
//Do what you want here that you would do in your code above when the value = -1
    
}

I get it, I'll use the standard method
__________________
wilian159 is offline
 



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 11:44.


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