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));
I need the %s
placeholder to be wrapped in literal %
characters without disrupting the placeholder.
A literal %
is specifed as %%
, so you want "... LIKE '%%%s%%'"