MySQL LIKE/Full String Check -
i have table save user agents mozilla, google chrome, opera etc etc strucure following
[ id , user_agent , exact_match ]
i want block user if uses 1 of user agent blocked in table count value of exact_match.
for example, if set exact_match 1 (true)
,i want perform full string check against user agent, if set 0 (false)
,i want use in mysql query.
i can if select user agents , depending on exact_match, can perform stristr function or strcmp.
can done using 1 sql query , not php code?
edit: checks should done case insensitive search.
thank you
this lot easier might think.
select id, user_agent, exact_match table (exact_match = 1 , user_agent = :user_agent_exact) or (exact_match = 0 , user_agent :user_agent_like)
then prepare statement bind user_agent_exact
, user_agent_like
strings required , away go!
Comments
Post a Comment