Raised This Month: $ Target: $400
 0% 

Help on sqlx


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Excelenton
Member
Join Date: Nov 2010
Old 12-04-2010 , 17:42   Help on sqlx
Reply With Quote #1

I am from Argentina (I speak Spanish) and wanted to know if someone could explain a little about how to use sqlx since I have a zombie server and need to build a system for recording and saving accounts through ammo packs if anyone sqlx I could explain a bit like appreciate it.
Excelenton is offline
Fedcomp
Member
Join Date: Feb 2009
Location: Russia
Old 12-04-2010 , 19:19   Re: Help on sqlx
Reply With Quote #2

Global:
PHP Code:
new Handle:g_h_Sql 
Connect to db:
PHP Code:
g_h_Sql SQL_MakeDbTuple("127.0.0.1""dbuser""dbpass""dbname"
Exec query:
PHP Code:
new s_Query[128], s_Name[32]

get_user_name(ids_Namecharsmax(s_Name))
format(s_Querycharsmax(s_Query), "SELECT steam_id FROM table WHERE name='%s'"s_Name)
SQL_ThreadQuery(g_h_Sql"Handle_Query"s_Query
Read results:
PHP Code:
public Handle_Query(i_FailStateHandle:h_Querys_Error[], i_Errcodes_Data[], i_DataSizeFloat:f_QueueTime)
{
    if (
i_FailState == TQUERY_CONNECT_FAILED)
        
set_fail_state("Could not connect to database.")
    else if (
i_FailState == TQUERY_QUERY_FAILED)
        
set_fail_state("Query failed.")
    else if (
i_Errcode)
        
log_amx("Error on query: %s"s_Error)
    else
        if (
SQL_NumResults(h_Query))
        {
            new 
i_SteamIDs_SteamID[32]
            
            
i_SteamID SQL_FieldNameToNum(h_Query"steam_id")
            
            while (
SQL_MoreResults(h_Query))
            {
                
SQL_ReadResult(h_Queryi_SteamIDs_SteamIDcharsmax(s_SteamID))
            
                if (
equal(s_SteamID"STEAM_0:0:123456")){
                   
// action example 
                
}
                
SQL_NextRow(h_Query)
            }
        }

use search to more
__________________
Fedcomp is offline
Send a message via ICQ to Fedcomp
Reply



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


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