Raised This Month: $ Target: $400
 0% 

SQL_PrepareQuery and "LIKE '%%s%'"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nepopus
Member
Join Date: Jun 2008
Location: Russia/Moscow
Old 07-19-2008 , 21:41   SQL_PrepareQuery and "LIKE '%%s%'"
Reply With Quote #1

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
__________________
hi maaaaaan
my server here soon

Last edited by Nepopus; 07-19-2008 at 22:27.
Nepopus is offline
Send a message via ICQ to Nepopus Send a message via Skype™ to Nepopus
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 07-19-2008 , 21:54   Re: SQL_PrepareQuery and "LIKE '%%s%'"
Reply With Quote #2

"%%" gets escaped to "%".
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Nepopus
Member
Join Date: Jun 2008
Location: Russia/Moscow
Old 07-19-2008 , 22:28   Re: SQL_PrepareQuery and "LIKE '%%s%'"
Reply With Quote #3

Quote:
Originally Posted by Hawk552 View Post
"%%" gets escaped to "%".
And where is the decision?
cuz i need only "LIKE '%epopu%'" at finish, like as in database
__________________
hi maaaaaan
my server here soon

Last edited by Nepopus; 07-19-2008 at 22:31.
Nepopus is offline
Send a message via ICQ to Nepopus Send a message via Skype™ to Nepopus
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 07-19-2008 , 22:32   Re: SQL_PrepareQuery and "LIKE '%%s%'"
Reply With Quote #4

So just do %%epopu%%, or %%%s%% (in the SMA).
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Nepopus
Member
Join Date: Jun 2008
Location: Russia/Moscow
Old 07-19-2008 , 22:57   Re: SQL_PrepareQuery and "LIKE '%%s%'"
Reply With Quote #5

Quote:
Originally Posted by XxAvalanchexX View Post
So just do %%epopu%%, or %%%s%% (in the SMA).
no error, but wasn't found nepopus as "LIKE '%%%s%%'" (%s = epopu). only find my name as nepopus(not epopu)
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
__________________
hi maaaaaan
my server here soon

Last edited by Nepopus; 07-19-2008 at 23:19.
Nepopus is offline
Send a message via ICQ to Nepopus Send a message via Skype™ to Nepopus
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:35.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode