[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Column-names part II
> > This is basic programming -- you always use arrays. We could build our
> > own array with pointers, but you can even get help from DBI and IC with
> > a hash query type...
> >
> > [perl]
> > my $db = $Db{query};
> > my $q = 'select * from address';
> > my $ary = $db->query( { sql => $q, hashref => 1 });
> > defined $ary
> > or die errmsg("query error for %s!", $q);
> >
> > my @out;
> > foreach my $row (@$ary) {
> > push @out, "Address for $row->{code} is $row->{address}";
> > }
> > return join "<br>", @out;
> > [/perl]
>
> Sorry to bother you again, but I get an error in the catalogs error.log:
> Safe: Can't call method "query" on an undefined value at (eval 181) line 4
>
> I tried to add query to SafeUntrap, but then I couldn't get IC to start...
>
Change the first two lines to the following:
[perl tables="address"]
my $db = $Db{address} or die 'Your choice of error message';
--
_/ _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
_/_/_/ _/_/ _/ _/ _/ _/_/ _/ K e v i n W a l s h
_/ _/ _/ _/ _/ _/ _/ _/_/ kevin@cursor.biz
_/ _/ _/_/_/_/ _/ _/_/_/ _/ _/