Thread $sth->fetchrow: will nicht so wie ich (21 answers)
Opened by pktm at 2004-01-03 16:31

renee
 2004-12-20 17:29
#35865 #35865
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
[quote=Tom,20.12.2004, 16:20][...]
Quote
Allerdings wundert mich wirklich, was du fuer einen Code hast, in dem du unbedingt eine foreach-Schleife statt einer while-Schleife benoetigst?!


HTML::Template Loop

[...]

Tom[/quote]
Kannst Du auch mit while machen:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
my $COLMAXITEM = 3;

my $idx = 0;
my @rows = ();
my $maxcount = scalar @item - 1;
while(my $it = $sth->fetchrow_hashref)
{
push @cols, {IMAGES_PATH => $images_path, IMAGESRC=> $it->{code}};
if(scalar @cols == $COLMAXITEM or $idx+1 == $maxcount)
{
push @rows, {COLS => [@cols]};
@cols = ();
}
$idx++;
}
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 $sth->fetchrow: will nicht so wie ich