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: [MySQL] Invalid DBI result handle -1
L 05/03/2011 - 21:03:28: [AMXX] Displaying debug trace (plugin "zp_sxg_bank.amxx")
L 05/03/2011 - 21:03:28: [AMXX] Run time error 10: native error (native "dbi_result")
L 05/03/2011 - 21:03:28: [AMXX] [0] zp_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(id, dbi_result(result, "pocket_ap"))
}
dbi_free_result(result)
}
firstspawn[id] = false;
}
}
}