SQL_PrepareQuery and "LIKE '%%s%'"
Hello, I have faced such problem:
I wish to get from a database a name of the player, not equal value, but like as. Directly from a database it looks so: (My nick name is nepopus) SELECT pp.name FROM ps_plr_profile as pp WHERE pp.name LIKE '%epopu%' ORDER BY pp.name ASC LIMIT 1 in .sma file I entered: new uniqueid[32] new fmt[1024] format(uniqueid, 31, "epopu") format (fmt, 1023, " SELECT pp.name FROM ps_plr_profile as pp WHERE pp.name LIKE '%%s%' ORDER BY pp.name ASC LIMIT 1 ", uniqueid) new Handle:rquery = SQL_PrepareQuery (sqlconnect, fmt) and in game i got a error with "LIKE='%%s%'", how can i do it with '%', '%', but w/o error :) huh... i hope you will understand my eng P.S. its last step for my first version ingame rank system for psychostats, and ill post it when remove this error |
Re: SQL_PrepareQuery and "LIKE '%%s%'"
"%%" gets escaped to "%".
|
Re: SQL_PrepareQuery and "LIKE '%%s%'"
Quote:
cuz i need only "LIKE '%epopu%'" at finish, like as in database :( |
Re: SQL_PrepareQuery and "LIKE '%%s%'"
So just do %%epopu%%, or %%%s%% (in the SMA).
|
Re: SQL_PrepareQuery and "LIKE '%%s%'"
Quote:
huh, It is very complex to me to express an idea :) i think i need to write '%' as another symbol, but dunno how to do this sorry my fault, dont need to format, search ftw :) http://forums.alliedmods.net/showthr...ght=%25%25s%25 |
| All times are GMT -4. The time now is 05:35. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.