tags:

views:

168

answers:

1

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.

+12  A: 

A literal % is specifed as %%, so you want "... LIKE '%%%s%%'"

Greg
perfect thank you RoBorg!
Pickledegg
another accepted answer for RoBorg :)
tharkun
Keep voting this up, I don't have a gold badge yet :p
Greg