[SOLVED] [MySQL] select problem.
Quote:
SOLVED!!:
You need to use %% to escape formatting.
|
Hello.
I have problem with:
PHP Code:
public check() { new Handle:query; query = SQL_PrepareQuery( g_DBConn, "SELECT `hostname` FROM `amx_guard` WHERE `plugins` LIKE '%test%'"); if ( !SQL_Execute( query )) { log_amx( "[Mysql] Can't execute query" ); SQL_FreeHandle( query ); return PLUGIN_HANDLED; } if ( SQL_NumResults(query) == 0) { log_amx( "[Mysql] No-one result" ); SQL_FreeHandle( query ); return PLUGIN_HANDLED; } new str[32]; SQL_ReadResult(query, 0, str, 254) server_print( "%s",str); SQL_FreeHandle( query ); return PLUGIN_CONTINUE; }
WHERE `plugins` LIKE '%test%'
it's always get NULL result.
in php all ok.. but in-game not work.
how to select I dont know.. anyone can help?
db contain:
PHP Code:
CREATE TABLE IF NOT EXISTS `amx_guard` ( `id` int(8) NOT NULL auto_increment, `hostname` varchar(250) default NULL, `plugins` varchar(250) default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
INSERT INTO `amx_guard` (`id`, `hostname`, `plugins`) VALUES (1, 'doit', 'war3ft.amxx, darkside.amxx, test.amxx');
|