in reply to Using DBI to create 'loose' search options with LIKE and %

You're missing quotes ('' in your foo example, but style is arbritrary here) and the scalar prefix for name (so you're searching for the name specified rather than the word 'name' :)).

$sth->execute("%$name%")

... is probably what you're looking for, although you might want to take precautions to check $name doesn't already start.end with %'s.

On a related note, check out SQL::AnchoredWildcards (alt.) -- an aide for turning strings with regex-style anchors into their SQL equivalents (ie, '^foo' > 'foo%', 'bar' > '%bar%', 'baz$' > '%baz').

    --k.