Question
How do I add the SQL wildcard characters to this:
sprintf("SELECT robot FROM robots WHERE robot LIKE '%s'",strtolower($user_agent));
as
sprintf("SELECT robot FROM robots WHERE robot LIKE '%%s%'",strtolower($user_agent));
blows up in a spectacular ball of flame,
PS sorry for the rather basic question. I'm cutting down on my coffee these days.
Solution
A literal %
is specifed as %%
, so you want "... LIKE '%%%s%%'"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow