Tag Mismatch
#1

I got tag mismatch on query lines
PHP код:
new by[128];
                        
mysql_format(1bysizeof(by), "SELECT BannedBy FROM bans WHERE PlayerBanned='%s'"PlayerName(playerid));
                        new 
admin mysql_query(1by);
                        new 
till[128];
                        
mysql_format(1tillsizeof(till), "SELECT time FROM bans WHERE PlayerBanned='%s'"PlayerName(playerid));
                        new 
time mysql_query(1till);
                        new 
re[128];
                        
mysql_format(1resizeof(re), "SELECT reason FROM bans WHERE PlayerBanmed='%s'"PlayerName(playerid));
                        new 
reason mysql_query(1re); 
And I don't know how to retrive the data in another way
Reply
#2

Bump!
Reply
#3

I'm not sure if you are doing so well but this should work!


PHP код:
//Connect to the mysql server!
//    Note: change host, user, database and password for your data.
new conhandle mysql_connect(hostuserdatabasepassword);
    
//Make format the string to be able to specify the query that we will do, this query get all the data in a row.
new query[72];
mysql_format(conhandlequerysizeof(query), "SELECT * FROM `bans` WHERE `PlayerBanned` = '%e'"PlayerName(playerid));
new 
Cache:cache mysql_query(conhandlequerytrue);
    
//In the variable cache will be store the result of the consultation, if the response was positive we obtain the columns in different variables.
if(cache_num_rows())
{
    new
        
reason[25], BannedBy[MAX_PLAYER_NAME], BannedTime[25]; //change the size of the strings!
    
cache_get_field_content(0"BannedBy"BannedByconhandle);
    
cache_get_field_content(0"time"BannedTimeconhandle);
    
cache_get_field_content(0"reason"BannedReasonconhandle);
        
    
//Here we can use the information stored in the variables, example of use:
    
new message[144];
    
format(messagesizeof(message), "You are banned from this server. Banned by: %s. Time: %s. Reason: %s"BannedByBannedTimeBannedReason);
    
SendClientMessage(playerid, -1message);
}
else
{
//If is player not banned from server
}
cache_delete(cache); //delete the information stored in the cache. 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)