Raised This Month: $ Target: $400
 0% 

Mysql Help me please


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SANTO37
Member
Join Date: Aug 2008
Old 02-11-2020 , 07:48   Mysql Help me please
Reply With Quote #1

Hi, firstly sorry for the bad english.
I want to draw the name of the team according to the ID address given in the plugin below. How can I do this?

PHP Code:
public stats_log_sql_teamteam[] )
{
    new 
team_id = -1
    
    
new Handle:Query         // The result handle, holds the query.
    
new error[512]
    
    new 
num_rows

    
    Query 
SQL_PrepareQuery(SqlConnection"SELECT * FROM `%s` WHERE `team_name` = ^"%s^";"AMXMD_SQL_TEAMteam)
    
    
// run the query
    
if(!SQL_Execute(Query))
    {
        
// if there were any problems
        
SQL_QueryError(Queryerror511)
        
log_amx("[AMXX] SQL Connection Failed: %s"error)
    }
    else
    {
        
num_rows SQL_NumResults Query )
    
        
// If team wasn't in the team table, then add it and get team_id
        
if( num_rows == )
        {
            
Query SQL_PrepareQuery(SqlConnection"INSERT INTO `%s` ( `team_name` ) VALUES ( ^"%s^" );"AMXMD_SQL_TEAMteam)
        
            
// run the query
            
if(!SQL_Execute(Query))
            {
                
// if there were any problems
                
SQL_QueryError(Queryerror511)
                
log_amx("[AMXX] SQL Connection Failed: %s"error)
            }
            else
            {
                
team_id SQL_GetInsertId Query )
            }
        }
        else 
// or just get the team_id
        
{
            
team_id SQL_ReadResult(Query0)
        }
        
        
SQL_FreeHandle(Query)
    }
    
    return 
team_id


I record MYSQL according to the team's name with the code above.

Take the name of the team according to the ID address I want to do. How can I do this?



Command works like this;
amx_match <CT's clan tag> <T's clan tag> <mr raund> <Config file> [recdemo|rechltv|recboth]

sample;
amx_match "AClan" "BClan" "mr10" "match" "recdemo"



I want it to work like this
amx_match <CT's clan ID> <T's clan ID> <raund> <Config file> [recdemo|rechltv|recboth]

sample;
amx_match "10" "11" "mr10" "match" "recdemo"

How can I edit ?
SANTO37 is offline
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 18:48.


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