But i hope to get some help. I want to associate a cell value in table with it's header. The header is not known, as it was generated by SQL query.
Sizes as header came from SQL return result. So then put it into an array,
@sizes = qw(S36 S37 S38 S39 S40 S41 S42);
Now, if James has size S38.
I want to print them as HTML table with sizes header:
+--------+--------+--------+-------+-------+-------+-------+
| S36 | S37 | S38 | S39 | S40 | S41 | S42 |
+--------+--------+--------+-------+-------+-------+-------+
| | | James | | | | |
+--------+--------+--------+-------+-------+-------+-------+
I know how to do this if sizes is part of row or result, but as table header?
How to manipulate this with Perl?
EDITED:
I try to summarize the code i tried...
SQL query:
select size from articles where order_number = "3";
Get into an array:
while(my $ref = $sth->fetchrow_hashref()) {
$size = "$ref->{'size'}";
push @sizes, $size;
}
Say, @sizes
is:
@sizes = qw(S36 S37 S38 S39 S40 S41 S42);
Create HTML header based on sizes:
+--------+--------+--------+-------+-------+-------+-------+
| S36 | S37 | S38 | S39 | S40 | S41 | S42 |
+--------+--------+--------+-------+-------+-------+-------+
Now, say from another SQL query, i know that James has S38. How to put into the right row cell of the above table. It would be:
+--------+--------+--------+-------+-------+-------+-------+
| S36 | S37 | S38 | S39 | S40 | S41 | S42 |
+--------+--------+--------+-------+-------+-------+-------+
| | | James | | | | |
+--------+--------+--------+-------+-------+-------+-------+