in reply to Database Listing Question
# --- push everything into an array --- my @match = (); foreach my $line (@array) { if ($line =~ /\Q$search\E/i) { my ($category,$item_name,$item_price,$item_picture) = split /\|/, $line; push @match, <<End_of_line; <td valign=top CLASS=MENU1> <img src="$photo_loc/$photo1" width=75 height=75><BR> <B>$item_name</B><BR> $item_price<BR> </td> End_of_line } } # --- Print the table --- my $inrow; print "<table>\n"; for (0..11) { # want 12 images $cell = shift(@match) or last; $inrow++, print "<tr>" if ($_ % 3) == 0; print "$cell"; $inrow--, print "</tr>\n" if ($_ % 3) == 2; } print "</tr>\n" if $inrow; print "</table>\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Database Listing Question
by lisaw (Beadle) on Jan 22, 2004 at 01:51 UTC |