AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Invalid DBI result handle -1 (https://forums.alliedmods.net/showthread.php?t=156287)

Lieutenant 05-03-2011 22:36

Invalid DBI result handle -1
 
Hi, I have been having trouble getting data from my db. I usually get a "Invalid DBI error" I have tried making the "dbi_query" connection with SQLx but had no luck. :( Any hints would be greatly appreciated.

Heres the Error
PHP Code:

L 05/03/2011 21:03:28: [MySQLInvalid DBI result handle -1
L 05
/03/2011 21:03:28: [AMXXDisplaying debug trace (plugin "zp_sxg_bank.amxx")
L 05/03/2011 21:03:28: [AMXXRun time error 10native error (native "dbi_result")
L 05/03/2011 21:03:28: [AMXX]    [0zp_sxg_bank.sma::OnPlayerSpawn (line 773

PHP Code:

public OnPlayerSpawn(id)
{
    if(
client_authed[id])
    {
        if(
firstspawn[id])
        {
            if(
dbc 0)
            {
                new 
sid[35]
                
player_info[id][player_balance] = -1
                
if(get_pcvar_num(bank_use_ip))
                    
get_user_ip(id,sid,34)
                else
                    
get_user_authid(id,sid,34)
                
                
result dbi_query(dbc"SELECT * FROM `bank` WHERE `sid` = '%s'"sid)
                if(
result != RESULT_NONE)
                {
                    
//dbi_nextrow(result)
                    
player_info[id][player_balance] = dbi_result(result,"amount")
                    
player_info[id][special_ap] = dbi_result(result,"special_ap")
                    
play_bank[id][BANK_LIMIT] = dbi_result(result"bank_limit")
                    
play_bank[id][BANK_INTTIME] = dbi_result(result"interest_time")
                    
play_bank[id][BANK_INTEREST] = dbi_result(result"interest_rate")
                    
zp_set_user_ammo_packs(iddbi_result(result"pocket_ap"))
                }
                
dbi_free_result(result
            }
            
firstspawn[id] = false;
        }
            
    }



Exolent[jNr] 05-03-2011 23:21

Re: Invalid DBI result handle -1
 
Use the new SQLx functions.
https://forums.alliedmods.net/showthread.php?t=46779

vi3tmofo 05-05-2011 20:46

Re: Invalid DBI result handle -1
 
good one


All times are GMT -4. The time now is 04:27.

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