How can I use the Columns from my table to populate the table header on my web page. Currently I am using 2 table functions one to make the table header the other to make the table data. The reason I seperate them is I am doing it in a while loop and if I put the header and data in the same table I will reproduce the header as many times as there is data in the array. Can I do this in one table and simply pull the column names right from the table?
print $query->table({-ALIGN=>'CENTER', BORDER=>''},
Tr({-bgcolor=>'#9933FF', -valign=>'TOP'},
[
th({-width=>'20%', -align=>'center'}, 'PLAYER NAME').th({-widt
+h=>'30%', -align=>'center'}, 'ADDRESS').th({-width=>'20%', -al
ign=>'center'}, 'PHONE NUMBER').th({-width=>'200', -align=>'center'},
+'FATHER').th({-width=>'200', -align=>'center'}, 'MOTHER').th({
-width=>'100', -align=>'center'}, 'DATE OF BIRTH').th({-width=>'100',
+-align=>'center'}, 'ASSOCIATION').th({-width=>'50', -align=>'c
enter'}, 'NUMBER').th({-width=>'50', -align=>'center'}, 'POSITION').th
+({-width=>'25', -align=>'center'}, 'SHOOTS'),
]
)
);
while (my @val = $sth->fetchrow_array ())
{
print $query->table({-ALIGN=>'CENTER', BORDER=>''},
Tr({-bgcolor=>'#99FF99', -valign=>'TOP'},
[
td({-width=>'20%', -align=>'center'}, $val[0]).td({-width=>'30
+%', -align=>'center'}, $val[1]).td({-width=>'20%', -align=>'ce
nter'}, $val[2]).td({-width=>'200', -align=>'center'}, $val[3]).td({-w
+idth=>'200', -align=>'center'}, $val[4]).td({-width=>'100', -a
lign=>'center'}, $val[5]).td({-width=>'100', -align=>'center'}, $val[6
+]).td({-width=>'50', -align=>'center'}, $val[7]).td({-width=>'
50', -align=>'center'}, $val[8]).td({-width=>'25', -align=>'center'},
+$val[9]),
]
)
);
print $query->end_html();
}