How do I get the FatherID instead of ID with this global?
Code:
sub { # return random related links
my (@links,$sth,$link);
my $tags = shift;
my ($cat_id) = each %{$DB->table('Links')->get_categories($tags->{ID})};
my $link_db = $DB->table('Links','CatLinks','Category');
$link_db->select_options ("ORDER BY RAND()","LIMIT 6");
my $sth = $link_db->select ( { CategoryID => $cat_id }, {isValidated => 'Yes'});
while (my $link = $sth->fetchrow_hashref) {
$link = Links::SiteHTML::tags('link', $link);
unless ($link->{ID} == $tags->{ID}){
push@links, $link;
}
}
return {relatedlnks=>\@links};
}
Code:
sub { # return random related links
my (@links,$sth,$link);
my $tags = shift;
my ($cat_id) = each %{$DB->table('Links')->get_categories($tags->{ID})};
my $link_db = $DB->table('Links','CatLinks','Category');
$link_db->select_options ("ORDER BY RAND()","LIMIT 6");
my $sth = $link_db->select ( { FatherID => $cat_id }, {isValidated => 'Yes'});
while (my $link = $sth->fetchrow_hashref) {
$link = Links::SiteHTML::tags('link', $link);
unless ($link->{ID} == $tags->{ID}){
push@links, $link;
}
}
return {relatedlnks=>\@links};
}
~ ERASER
Free JavaScripts @ Insight Eye