in reply to Simple DBI question, select rows based on an array

Hi,

Would it be something like this?

$sqlfmt = "SELECT val1,val2,val3 where val1 = %d"; foreach (@values) { $sql = sprintf($sqlfmt, $_); }

Replies are listed 'Best First'.
Re^2: Simple DBI question, select rows based on an array
by Gangabass (Vicar) on Nov 05, 2009 at 05:11 UTC

    This is the wrong way!

    The right way is to do it like this:

    foreach my $value (@values) { $sth->execute($value); }