in reply to DBI Question

You can do this:

$sth = $dbh->prepare("SELECT name FROM people WHERE name LIKE ?"); $sth->execute('%foo%');

Just, remember, as I said in chatterbox, to escape the wildcard character '%'.

Replies are listed 'Best First'.
Re: Re: DBI Question
by dsb (Chaplain) on Jan 17, 2001 at 03:13 UTC
    The value I will bind to the placeholder is SCALAR variable. Can this still be done like:
    $sth = $dbh->prepare("SELECT name FROM people WHERE name LIKE ?"); $sth->execute( "$foo\%" );

      You'll have to test it for yourself, but I don't see why not...

      An easier way, if you know that you're always doing wildcard searches, might be:

      $sth->execute('%' . $foo . '%');
        That helps alot...Thanks!!!