Thread nochmal HTML::Template und DBI: diesmal: LOOPs (5 answers)
Opened by pktm at 2004-12-30 20:19

renee
 2004-12-30 20:42
#642 #642
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
probier mal:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
my $cmd = "SELECT titel FROM seiten";
my $sth = $dbh->prepare($cmd) || die $dbh->errstr;
my @array = ();
if( my $rv = $sth->execute ){
  while($hash = $sth->fetchrow_hashref()){
    push(@array,$hash);
  }
  if(@array){
    $template->param( "SEITEN" => \@array );
  }
  else{
    $template->param( "SEITEN" => \[ { titel => 'keine Seite vorhanden',  } ] );
  }
}
else{
  die "Konnte Seitentitel nicht aus seiten-Datenbank lesen: " . $dbh->errstr;
}
\n\n

<!--EDIT|renee|1072809780-->
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread nochmal HTML::Template und DBI: diesmal: LOOPs