Check ban table MySQL help
#1

PHP код:
            SendClientMessage(playerid, COLOR_GREEN, "NOTICE: You only receive six results at a time. Narrow your search for better results");
            
format(string, 128, "SELECT * FROM bans WHERE name LIKE '%s' LIMIT 6", searchname);
            
mysql_query(string);
            
mysql_store_result();
            while(
mysql_retrieve_row())
            {
                
mysql_get_field("name",searchname);
                
mysql_get_field("admin",admin);
                
mysql_get_field("reason",reason);
                
mysql_get_field("time",time);
                
mysql_get_field("ip",ip);
                
format(string, 128, "NAME: %s - IP: %s - ADMIN: %s - REASON: %s - TIME: %s", searchname, ip, admin, reason, time);
                
SendClientMessage(playerid, COLOR_ADMINCMD, string);
            }
            
mysql_free_result(); 
It doesnt work though when I do it though. I have stuff in the ban table and it doesn't show any results. Thanks.
Reply
#2

Add wildcard characters:

PHP код:
SELECT * FROM bans WHERE name LIKE '%%%s%%' LIMIT 6 
%% inserts a literal percent sign.
Reply
#3

Thank you Vince!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)