[ic] Column-names part II -> Solved!

Rene Hertell interchange-users@icdevgroup.org
Fri Aug 16 10:04:00 2002


> This part I didn?t understand. How could I use it for example in
> this query?
> I would like to make a dynamic table that displays each column if there is
> any.
>
>
> [perl tables=osoite]
> my ($ary, $field_hash, $name_array)= $Db{osoite}->query("select * from
> osoite where ((rrka='1') or (rral='1')) order by nimi");
>
> $out .="<table><tr><td>field1</td><td>field2</td></tr>";
> foreach $line (@$ary)
> {
> my ($code,$nimi)= @$line;
> $out .="<tr>";
> $out .="<td>$code</td>";
> $out .="<td>$nimi</td>\n";
> $out .="<tr>";
> }
> $out .="</table>";
> return $out;
> [/perl]

I finally solved my problem in how to get the fieldnames out:

my ($column)= join " ",  @$name_array;

did the trick :)

Regards, Rene