Gossamer Forum
Quote Reply
Random review
I want to display a random review, using a global,
based on a sub like this ........

sub {
my $tags = shift;
my $link_db = $DB->table('Links','CatLinks');
my $cat_id = $tags->{Random_CatID};
my $limit = $tags->{Random_Limit} || 1;
my (@output, $sth);
$link_db->select_options ('ORDER BY RAND()', "LIMIT $limit");
if ($cat_id) {
$sth = $link_db->select ( { CategoryID => $cat_id });
}
else {
$sth = $link_db->select ({ spreis => 'Yes' } );

}
while (my $hash = $sth->fetchrow_hashref) {
push @output, $hash;
}
return { random_spreis => \@output }
}



What needs to be changed?

--
Michael Skaide

http://www.cycle24.de