Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Displaying random links without duplicate entries

Quote Reply
Displaying random links without duplicate entries
I'm playing around with a random link code I found posted, but wanted to see how I could get it to post three links at a time rather than just one link. Most importantly, it would be sure not to post the same link twice. I have it setup as a template global called <%randlink%> and the code is as follows:

Code:

sub {
my $table = $DB->table('Links');
$table->select_options ('ORDER BY RAND() LIMIT 1');
my $link = $table->select( { 'isValidated' => 'Yes', 'isFeatured' => 'Yes' } )->fetchrow_hashref;
my $html = Links::SiteHTML::display('rand_link2', $link);
return $html;
}


Any help would be appreciated,
Perl Hopefull