Raised This Month: $ Target: $400
 0% 

Mysql handle returning 0 on query problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
SaintK
Veteran Member
Join Date: Mar 2004
Old 02-27-2006 , 08:40   Mysql handle returning 0 on query problem
Reply With Quote #1

getting a strange callback could any one see if i am doing it wrong

Code:
#include <amxmodx>
#include <amxmisc>
#include <dbi>

new clientname[32]
new usersteam[32]

new user_id[32]
new user_steamid[32]
		
new Sql:dbc 
new Result:result
new query[256]

new error[33]

new num 
new i


public client_authorized(id){
	
	get_user_name(id,clientname,31)	
	get_user_authid(id,usersteam,31)
	
	
	result = dbi_query(dbc,"select * from `savednames` where name = '%s'", clientname)
	num = dbi_num_rows(result)
	i = 1
	
	while ( i < num )
	{  
         dbi_nextrow(result)
	dbi_result(result,"steamid", user_steamid, 31)
	dbi_free_result(result)	
	dbi_result(result,"name", user_id, 31)
	dbi_free_result(result)
	i++;
	}
			       
				
	if (  contain(user_id,clientname) && contain(user_steamid,usersteam)   )
	
	{
	//client_print(id, print_chat, "Welcome to our server.  We've Preserved your information.  Enjoy your stay.")
	//server_print("[Logger-ClientAuth] Logged into database: %s (%s).", clientname, usersteam)
	server_print("[Logger-ClientAuth-1] Logged into database: %s (%s).", user_id, user_steamid)	
	return PLUGIN_HANDLED 
	} 
	
	else if(result == RESULT_NONE)
    {
       server_print("[Logger-ClientAuth-1] ERROR. User(%s)(%s) does not exist in database.", user_id, user_steamid)
	return PLUGIN_HANDLED 
    }
    
	else
	
	{
	client_print(id, print_chat, "You are not allowd to use this name please chose another !!!")
	server_cmd("kick %d This name cannot be used",id)
	client_cmd(id , "disconnect") 
	}
	
	return PLUGIN_HANDLED 
	
	}
the databse table has ID steamid name

the query error is
02/27/2006 - 13:13:44: [MYSQL] Invalid database handle 0
02/27/2006 - 13:13:44: [AMXX] Displaying debug trace (plugin "NickProtect.amxx")
02/27/2006 - 13:13:44: [AMXX] Run time error 10: native error (native "dbi_query")
02/27/2006 - 13:13:44: [AMXX] [0] NickProtect.sma::client_authorized (line 53)
Dropped sucks from server
Reason: Client sent 'drop'

i am presumeing that its returning 0 on the rows wich just shouldnt be true as there is one name in it can any one see anything wrong here...
SaintK is offline
 


Thread Tools
Display Modes

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 20:17.


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