Gossamer Forum
Quote Reply
Error in a sub
hi

I have created in the table Links a new field called "FAQ"
On the category page where links are displayed according the value of the field FAQ

I have creted this sub

sub {
my $vars = shift;
my $cat = $vars->{ID};
my $db = $DB->table('CatLinks','Links');
my (@output, $sth);
my $sth = $db->select ({ CategoryID => '17'});
while (my $hash = $sth->fetchrow_hashref) {
push @output, $hash;
}
return \@output;
}

And it works when a fix value of CategoryID.
my $sth = $db->select ({ CategoryID => '17'});

Whereas if I change in
my $sth = $db->select ({ CategoryID => $cat});
or
my $sth = $db->select ({ CategoryID => $vars->{ID}});
it does not work

What is the trouble?
Quote Reply
Re: [vercyb] Error in a sub In reply to
ID is the links' ID number. It seems like you mean to be using CategoryID.

Code:
my $sth = $db->select ({ CategoryID => $vars->{CategoryID}});

Philip
------------------
Limecat is not pleased.