|< 1 2 >| | 14 Einträge, 2 Seiten |
1
2
3
4
5
6
use CGI qw(:standard);
print Tr(
td( [ @result[ 0 .. 2 ] ] ) ,
td( [ @result[ 3 .. 5 ] ] )
)
my $sql = " SELECT id,name FROM test ORDER BY RAND() LIMIT 0,6";
1
2
3
4
5
6
Tabelle mit 2 zeilen und 3 spalten
-----------------------
| HUND | KATZE | MAUS | # zeile 1
-----------------------
| LÖWE | CAMEL | STIER| # zeile 2
-----------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
while(my ($id,$name) = $sth -> fetchrow_array){
push @result,$name;
}
print qq {
<tr>
<td width="30"><div align="center">$result[0]</div></td>
<td width="30"><div align="center">$result[1]</div></td>
<td width="30"><div align="center">$result[2]</div></td>
</tr>
<tr>
<td width="30"><div align="center">$result[3]</div></td>
<td width="30"><div align="center">$result[4]</div></td>
<td width="30"><div align="center">$result[5]</div></td>
</tr>
};
1
2
3
4
5
6
7
for my $i (0..1) {
print "<tr>\n";
for my $j (0..2) {
print qq { <td width="30"><div align="center">$result[$i*3+$j]</div></td>\n};
}
print "</tr>\n";
}
1
2
3
4
5
6
7
8
9
10
print "<tr>\n";
my $count = 0;
while ( my ($id,$name) = $sth -> fetchrow_array) {
if ( $count > 0 && $count % 3 == 0 ) {
print"</tr>\n<tr>\n";
}
print qq { <td width="30"><div align="center">$name</div></td>\n};
$count++;
}
print "</tr>\n";
1
2
3
4
5
6
7
8
9
10
<tr>
<td width="30"><div align="center">Hund</div></td>
<td width="30"><div align="center">Katze</div></td>
<td width="30"><div align="center">Maus</div></td>
</tr>
<tr>
<td width="30"><div align="center">Kamel</div></td>
<td width="30"><div align="center">Dromedar</div></td>
<td width="30"><div align="center">Lama</div></td>
</tr>
1
2
3
4
5
6
7
8
9
10
<tr>
<td>Hund</td>
<td>Katze</td>
<td>Maus</td>
</tr>
<tr>
<td>Kamel</td>
<td>Dromedar</td>
<td>Lama</td>
</tr>
print qq {<a href="fred.html",target="_new">Open a new frame</a>\n}
1
2
3
4
5
6
7
8
print qq~
<tr>
<td style="font-color:red;font-weight:bold;">$row[0]</td>
<td style="font-color:red;font-weight:bold;">$row[1]</td>
<td style="font-color:red;font-weight:bold;">$row[2]</td>
<td style="font-color:red;font-weight:bold;">$row[3]</td>
</tr>
~;
|< 1 2 >| | 14 Einträge, 2 Seiten |