SA-MP Forums Archive
Check ban table MySQL help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Check ban table MySQL help (/showthread.php?tid=249377)



Check ban table MySQL help - s1k - 18.04.2011

PHP код:
            SendClientMessage(playeridCOLOR_GREEN"NOTICE: You only receive six results at a time. Narrow your search for better results");
            
format(string128"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(string128"NAME: %s - IP: %s - ADMIN: %s - REASON: %s - TIME: %s"searchnameipadminreasontime);
                
SendClientMessage(playeridCOLOR_ADMINCMDstring);
            }
            
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.


Re: Check ban table MySQL help - Vince - 18.04.2011

Add wildcard characters:

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


Re: Check ban table MySQL help - s1k - 18.04.2011

Thank you Vince!