On Wed, May 28, 2003 at 12:31:33PM -0400, Thomas Good wrote: > Hi, how does one use LIKE and a wildcard with variable binding?? > > $q = qq |select * from x where y like ?|; > ... > $sth->execute($some_variable) > > where does the % go??
The % must be part of the bound value. For example:
$sth->execute("$some_variable%");
or
$some_variable .= '%';
$sth->execute($some_variable);
depending on whether you want to modify $some_variable.
Ronald
