Gossamer Forum
Quote Reply
Custom random link
Hi

I have a global that is supposed to return a random link from the links with flag (isSponsored = Yes)

sub {
my $db = $DB->table('Links');
my $total = $db->count ( 'isValidated' => 'Yes');
my $rand = int( rand($total) );
my $cond = GT::SQL::Condition->new('isSponsored', '=', 'Yes');
$db->select_options ("LIMIT $rand, 1");
my $link = $db->select->fetchrow_hashref;
return Links::SiteHTML::display('link', $link);
}

The gloabl is returing links regardless of my condition (all over the database)

Any suggsetions?
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Subject Author Views Date
Thread Custom random link katabd 1858 Oct 22, 2003, 10:23 AM
Post Re: [katabd] Custom random link
afinlr 1806 Oct 22, 2003, 10:28 AM
Post Re: [katabd] Custom random link
katabd 1779 Oct 23, 2003, 4:35 AM