Thread mysql-query länge (17 answers)
Opened by Froschpopo at 2006-10-17 00:21

pq
 2006-10-17 20:53
#34819 #34819
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
[quote=renee,17.10.2006, 08:41]
Code: (dl )
1
2
3
4
5
my @names = qw(name1 name2 ...);
my $select = 'SELECT fields from tble where name IN('.join(',',('?') x scalar(@names)).')';

my $sth = $dbh->prepare or die $dbh->errstr();
$sth->execute(@names);
[/quote]
das muss
my $sth = $dbh->prepare($select) or die $dbh->errstr();
heißen.
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread mysql-query länge