Raised This Month: $ Target: $400
 0% 

Could someone correct this small plugin?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
TheRadiance
Senior Member
Join Date: Nov 2007
Location: Kazakhstan
Old 04-05-2009 , 21:50   Re: Could someone correct this small plugin?
Reply With Quote #5

Example of connection:
PHP Code:
#include < amxmodx >
#include < sqlx >

new Handle:g_hSqlCon

public plugin_init ( )
{
    
register_plugin ( ..., ..., ..., )
    
mysql_init ( )
}

mysql_init ( )
{
    new 
szHost 32 ]
    new 
szUser 32 ]
    new 
szPass 32 ]
    new 
szDtbe 32 ]
    new 
szError 128 ]
    new 
iError

    get_pcvar_string 
"amx_sql_host"szHostsizeof szHost ) - )
    
get_pcvar_string "amx_sql_user"szUsersizeof szUser ) - )
    
get_pcvar_string "amx_sql_pass"szPasssizeof szPass ) - )
    
get_pcvar_string "amx_sql_db"szDtbesizeof szDtbe ) - )

    new 
Handle:hSqlTpl SQL_MakeDbTuple szHostszUserszPassszDtbe )
    
g_hSqlCon SQL_Connect hSqlTpliErrorszErrorsizeof szError ) - )

    if ( !
g_hSqlCon )
    {
        
// .. connection failed
    
}

    
// .. successfully connected

public plugin_end ( ) // .. this is not so necessary
    
SQL_FreeHandle g_hSqlCon 

Last edited by TheRadiance; 04-06-2009 at 05:01.
TheRadiance is offline
Send a message via ICQ to TheRadiance
 



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 02:18.


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