First, please read How (Not) To Ask A Question, in particular the section on titles.
This is not a Perl issue, but an SQL issue. You can resolve this by using the IN operator.
As a side note, you should seriously consider using placeholders in your code. It will handle any character escaping that has to be performed and adds a layer of security. As an example, here is how you might form your $sql variable for finding all occurrences in your year array:
my $sql = "SELECT DISTINCT name, email, addr, location FROM my_users WHERE year IN (" . join(', ', ('?') x @year) +. ") "; $i = 0; my $query = $dbh->prepare($dbh) or die "Prepare failure: ".$dbh->errst +r; foreach my $year (@year) { $query->bind_param(++$i,$year); } $query->execute or die "Execute failure: ".$dbh->errstr;
In reply to Re: DBI, MAP Help!
by kennethk
in thread DBI, MAP Help!
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |