[ic] Column-names part II

Stefan Hornburg Racke interchange-users@icdevgroup.org
Fri Aug 16 08:39:03 2002


"Rene Hertell" <interchange@hertell.com> writes:

> Hi guys,
> 
> I asked about a month ago on how to get the fieldnames from a query
> (http://icdevgroup.org/pipermail/interchange-users/2002-July/022988.html),
> and I got a solution from Mike. After struggling with it now for some time I
> can't still figure out in how to get the column-names out...
> 
> I have a query like this (according to the icfaq, this is the fastest way in
> handling a query, but wouldn't it be better to place the query inside the
> [perl] tags?):

Yes.

> 
> 
> [query arrayref=my_sel_code sql="select * from address where ((rrka='1') or
> (rral='1')) order by name"][/query]
> 
> [perl]
> my $ary = $Tmp->{my_sel_code};

[perl tables=address]
my $ary = $Db{address}->query("select ...");

> foreach $line (@$ary)
>  {
>   my ($code,$name,$title....  +20 fields more...)= @$line;
>     if($name){$out .="$name<br>\n"};
>     if($title){$out .="$title<br>\n"};
> etc.
> 
>     return $out;
> [/perl]
> 
> Could someone be so kind and help me out in how to do the foreach-part so
> that I wouldn't have to specify out all columns separately. The reason is
> that I have this code on 10 different pages, and it is quite a pain to go
> trough each page when I have to add a few columns..

[query hashref=my_sel_code ...]

Ciao
        Racke

-- 
Prolific Interchange Consulting (Excellent German Quality !).
Take a look at Materialboerse (http://www.materialboerse.de/), WITT 
(http://www.witt-weiden.de/), Boxmover (http://shop.boxmover.ch/) or 
Passionshop (http://www.passionshop.com/racke). Need a shop ? Contact us.