Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Count special Links with a Global

Quote Reply
Count special Links with a Global
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
Subject Author Views Date
Thread Count special Links with a Global jupp 2824 May 27, 2004, 4:31 AM
Thread Re: [jupp] Count special Links with a Global
Andy 2724 May 27, 2004, 5:12 AM
Thread Re: [Andy] Count special Links with a Global
jupp 2718 May 27, 2004, 5:53 AM
Thread Re: [jupp] Count special Links with a Global
Andy 2720 May 27, 2004, 6:04 AM
Thread Re: [Andy] Count special Links with a Global
jupp 2710 May 27, 2004, 11:14 PM
Post Re: [jupp] Count special Links with a Global
jupp 2692 Jun 2, 2004, 5:33 AM