Hi. Does this global work any better?
my $cat_id = $_[0];
my $cat_db = $DB->table('Category');
my $full_name = $cat_db->select ( ['Full_Name'], { 'ID' => $cat_id })->fetchrow;
if !$full_name return "Invalid category ID passed...";
my $sth = $cat_db->select( GT::SQL::Condition->new('Full_Name','LIKE',"$full_name%") ) || return $GT::SQL::error;
my @ids;
while (my $hit = $sth->fetchrow_hashref) {
push(@ids,$hit->{ID});
}
my $count = $DB->table('CatLinks','Links')->count( GT::SQL::Condition->new( 'statistik','=','1','CategoryID', 'IN', \@$ids) );
$count ? return $count || return 0;
}
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Code:
sub { my $cat_id = $_[0];
my $cat_db = $DB->table('Category');
my $full_name = $cat_db->select ( ['Full_Name'], { 'ID' => $cat_id })->fetchrow;
if !$full_name return "Invalid category ID passed...";
my $sth = $cat_db->select( GT::SQL::Condition->new('Full_Name','LIKE',"$full_name%") ) || return $GT::SQL::error;
my @ids;
while (my $hit = $sth->fetchrow_hashref) {
push(@ids,$hit->{ID});
}
my $count = $DB->table('CatLinks','Links')->count( GT::SQL::Condition->new( 'statistik','=','1','CategoryID', 'IN', \@$ids) );
$count ? return $count || return 0;
}
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!