Raised This Month: $ Target: $400
 0% 

Help With Mysql Consult


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
dark22
Junior Member
Join Date: Dec 2008
Old 05-12-2010 , 23:16   Help With Mysql Consult
Reply With Quote #1

Hi,

Have searched around the forum, but does not have much knowledge of the module sqlx, so I ask for help to try to run the script below. What does he want to search the MySQL database, the server name if the name is not equal to table in the database, return error. The compilation does not return errors, but the plugin is unable to perform the search in the database.

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

new Handle:g_hTuple;
new g_iError, g_szError[ 128 ];

public plugin_init( ) {
	g_hTuple = SQL_MakeStdTuple( );
	
	new Handle:hConnection = SQL_Connect( g_hTuple, g_iError, g_szError, 127 );
	if( hConnection == Empty_Handle ) {
		set_fail_state( g_szError );
	}
	
	VerifyTable( hConnection );
	
	SQL_FreeHandle( hConnection );
}

VerifyTable( Handle:hConnection ) {
	new Handle:hQuery = SQL_PrepareQuery( hConnection,
	"SELECT mydata FROM mytable WHERE id = 1"
	);
	
	if( !SQL_Execute( hQuery ) ) {
		SQL_QueryError( hQuery, g_szError, 127 );
		log_amx( "Failed to create table: %s", g_szError );
	}
	
	new hostname[64]
	get_cvar_string("hostname",hostname,63)

	//*if(contain(hostname, "My Hostname"))
	if(contain(hostname, "%s"),hQuery)
	set_fail_state("My Hostname incorrect")
}
This code was caught in the topic: (Credits for Exolent[jNr])

https://forums.alliedmods.net/showth...=103229&page=2

I appreciate any idea.
dark22 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 03:35.


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