in reply to variable substitution using Like in DBI

my $sth = $dbh->prepare("SELECT someFields FROM mytable WHERE myqualif +ier LIKE ?"); $sth->execute("test*");

We're not surrounded, we're in a target-rich environment!

Replies are listed 'Best First'.
Re: Re: variable substitution using Like in DBI
by menolly (Hermit) on Sep 11, 2003 at 19:25 UTC
    More specifically,
    my $input = param('input'); #or however you're getting it chomp $input; #any other processing to deal with unwanted characters my $sth = $dbh->prepare("SELECT someFields FROM mytable WHERE myqualif +ier LIKE ?"); $sth->execute("$input*");

      That is exactly what I tried but to no avail. It doesn't return any results. I'm assuming (note: assuming) that its a qwirk with Access or ODBC that I'm just not accounting for. Anymore ideas are VERY much welcome.. thanks guys.

      edit FYI my query will run correctly with that syntax but does not produce the same results as running it interactively. I get no results in script, and the appropriate number in the interactive

        Are you checking $sth->err?