Raised This Month: $ Target: $400
 0% 

SQL request


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
worldspawn
Senior Member
Join Date: Aug 2009
Location: Russia, Yekaterinburg
Old 11-22-2009 , 08:04   SQL request
Reply With Quote #1

So i tested this query and it works perfect
here it is

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

new Handle:g_h_SqlHandle:g_h_Sql_Connectbool:g_b_Connected_SQL false

public SQL_Connection(id

    new 
s_Error[128], i_Error 

    g_h_Sql 
SQL_MakeDbTuple("--host--""--dbuser--""--dbpass--""--dbname--"
    
g_h_Sql_Connect SQL_Connect(g_h_Sqli_Errors_Errorcharsmax(s_Error)) 

    if (
g_h_Sql_Connect == Empty_Handle
    { 
        
client_print(idprint_chat,"Can't connect to MySQL, error:"
        
client_print(idprint_chat,"%s"s_Error
        
log_amx("Can't connect to MySQL, error: %s"s_Error

        return 
PLUGIN_HANDLED 
    
}else{
    
g_b_Connected_SQL true 
    
}
    return 
PLUGIN_CONTINUE 
}

public 
get_wins(id)
{
    if (
g_b_Connected_SQL)
    {
        new 
Handle:queryauthid[32], s_Error[128]

        
get_user_authid(idauthidcharsmax(authid))

        
query SQL_PrepareQuery(g_h_Sql_Connect"SELECT --column-- FROM --table-- WHERE (authid='%s')"authid)

        if (!
SQL_Execute(query))
        {
            
SQL_QueryError(querys_Errorcharsmax(s_Error))
            
server_print("Can't execute MySQL query, error: %s"s_Error)
            
log_amx("Can't execute MySQL query, error: %s"s_Error)
        }else{
            new 
i_Somethings_Something[32]

            
i_Wins SQL_FieldNameToNum(query"--column--")
            if(
i_Wins 0)
            {
            }else{
                while (
SQL_MoreResults(query))
                {
                    
SQL_ReadResult(queryi_Somethings_Something3)

                    if (
equal(s_Something""))
                    {
                        
client_print(idprint_chat,"Yor result: nothing")
                    }else{
                        
client_print(idprint_chat,"Yor result: %s"s_Something)
                    }

                    
SQL_NextRow(query)
                }
            
                
SQL_FreeHandle(query)
            }
        }
    }
}

public 
plugin_end() 

    
SQL_FreeHandle(g_h_Sql_Connect
    
SQL_FreeHandle(g_h_Sql


Last edited by worldspawn; 11-25-2009 at 08:55. Reason: code now here
worldspawn is offline
Send a message via ICQ to worldspawn Send a message via Skype™ to worldspawn
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-22-2009 , 08:20   Re: SQL request
Reply With Quote #2

You should have kept your problem and the solution, it could have help others people.
__________________
Arkshine is offline
worldspawn
Senior Member
Join Date: Aug 2009
Location: Russia, Yekaterinburg
Old 11-22-2009 , 09:38   Re: SQL request
Reply With Quote #3

so, sql query (or request)at first post now!

Last edited by worldspawn; 11-25-2009 at 08:44. Reason: look first post
worldspawn is offline
Send a message via ICQ to worldspawn Send a message via Skype™ to worldspawn
worldspawn
Senior Member
Join Date: Aug 2009
Location: Russia, Yekaterinburg
Old 11-23-2009 , 09:10   Re: SQL request
Reply With Quote #4

sorry, double post
worldspawn is offline
Send a message via ICQ to worldspawn Send a message via Skype™ to worldspawn
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 11-23-2009 , 09:12   Re: SQL request
Reply With Quote #5

Non-steam?
__________________
xPaw is offline
worldspawn
Senior Member
Join Date: Aug 2009
Location: Russia, Yekaterinburg
Old 11-23-2009 , 09:16   Re: SQL request
Reply With Quote #6

STEAM_0:0:20800076
i'm in steam - epileptick
u think lots of russians have non-steam products?

Last edited by worldspawn; 11-23-2009 at 09:19.
worldspawn is offline
Send a message via ICQ to worldspawn Send a message via Skype™ to worldspawn
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 11-23-2009 , 10:15   Re: SQL request
Reply With Quote #7

No, i used asked it because youre using IP instead of Steam, wich is stupid.
__________________
xPaw is offline
worldspawn
Senior Member
Join Date: Aug 2009
Location: Russia, Yekaterinburg
Old 11-23-2009 , 10:17   Re: SQL request
Reply With Quote #8

if you don't know how to help, please don't post here
worldspawn is offline
Send a message via ICQ to worldspawn Send a message via Skype™ to worldspawn
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 11-23-2009 , 12:19   Re: SQL request
Reply With Quote #9

That's right, xPaw, GTFO.
__________________
hleV is offline
worldspawn
Senior Member
Join Date: Aug 2009
Location: Russia, Yekaterinburg
Old 11-23-2009 , 13:13   Re: SQL request
Reply With Quote #10

only for you changed to authid
so anybody knows is it the right way to get result from sql?
worldspawn is offline
Send a message via ICQ to worldspawn Send a message via Skype™ to worldspawn
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 14:39.


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