Hallo,
i have a Problem to count some special Link in a Global.
I add a Column in Table Links called statistik as intr.
with a Value 1or 0.
Now i want to count the Link in the every Category with the value 1 and display them. I wrote a global like :
sub {
my $output;
my $cat_db = $DB->table('Category');
my $cat_id=shift;
my $sth = $cat_db->select ( {'ID' => $cat_id });
while (my ($id) = $sth->fetchrow_array) {
my $all_ids = $DB->table('Category')->children($id);
my $link_db = $DB->table('Links','CatLinks');
my $condition = GT::SQL::Condition->new( 'statistik','=','1','CategoryID', 'IN', \@$all_ids);
my $out = $link_db->count($condition);
$output .= qq ($out);
}
return $output;
}
in subcategory.html i wrote
<small><i>(<%Number_of_Links%>)</i></small> <small><font color=darkblue><i>(<%cat_statistik($ID)%>)</i></font></small>
But i have a problem:
For example
When i select with sqlmonitor the Linkssql where statistik like 1 the value is 1000.
1) If i use my Global the value (statistik=1) of all Links in Categorys is 990
2) In the subcategory the value(statistik=1) of all Links will less then the hole links.
Any help is welcome
i have a Problem to count some special Link in a Global.
I add a Column in Table Links called statistik as intr.
with a Value 1or 0.
Now i want to count the Link in the every Category with the value 1 and display them. I wrote a global like :
sub {
my $output;
my $cat_db = $DB->table('Category');
my $cat_id=shift;
my $sth = $cat_db->select ( {'ID' => $cat_id });
while (my ($id) = $sth->fetchrow_array) {
my $all_ids = $DB->table('Category')->children($id);
my $link_db = $DB->table('Links','CatLinks');
my $condition = GT::SQL::Condition->new( 'statistik','=','1','CategoryID', 'IN', \@$all_ids);
my $out = $link_db->count($condition);
$output .= qq ($out);
}
return $output;
}
in subcategory.html i wrote
<small><i>(<%Number_of_Links%>)</i></small> <small><font color=darkblue><i>(<%cat_statistik($ID)%>)</i></font></small>
But i have a problem:
For example
When i select with sqlmonitor the Linkssql where statistik like 1 the value is 1000.
1) If i use my Global the value (statistik=1) of all Links in Categorys is 990
2) In the subcategory the value(statistik=1) of all Links will less then the hole links.
Any help is welcome