Gossamer Forum
Quote Reply
Second Condition
Can this global have a second condition such as: isImg = yes. I have been trying to fit this in but getting noware fast! Unsure

Code:
sub {
my $tags = shift;
my $link_db = $DB->table('Links','CatLinks');
my $cat_id = $tags->{Rand_SS_CatID};
my $all_ids = $DB->table('Category')->children($cat_id);
push @$all_ids, $cat_id;
my $limit = $tags->{Random_Limit} || 3;
my (@output, $sth);
$link_db->select_options ('ORDER BY RAND()', "LIMIT $limit");
my $cond = GT::SQL::Condition->new('isValidated','=','Yes', 'CategoryID', 'IN', \@$all_ids);
if ($cat_id) {
$sth = $link_db->select ( $cond);
}
else {
$sth = $link_db->select({isValidated=>'Yes'});
}
while (my $link = $sth->fetchrow_hashref) {
push @output, $link;
}
return { Rand_SS_Loop => \@output }
}
Subject Author Views Date
Thread Second Condition JohnOJ 1638 May 13, 2004, 2:07 PM
Post Re: [JohnOJ] Second Condition
Andy 1573 May 14, 2004, 12:11 AM