Nar has asked for the wisdom of the Perl Monks concerning the following question:
my $id_string = '1,2'; my $value_lookup = $dbh->prepare(" SELECT value WHERE id IN (?)"); #EXECUTE SQL QUERY $value_lookup->bind_param(1, $id_string); $value_lookup->execute() or debug ($DBI::errstr); while(my($value) = $value_lookup->fetchrow_array()) { print "$value\n"; }
What would be the proper way to bind a variable on an in string?my $value_lookup = $dbh->prepare(" SELECT value WHERE id IN (1,2)"); #EXECUTE SQL QUERY $value_lookup->execute() or debug ($DBI::errstr); while(my($value) = $value_lookup->fetchrow_array()) { print "$value\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI bind error
by JavaFan (Canon) on Jan 18, 2009 at 02:26 UTC | |
by Nar (Novice) on Jan 18, 2009 at 02:36 UTC | |
by ikegami (Patriarch) on Jan 18, 2009 at 02:46 UTC |