I put this global together from another Alex wrote to return random links which would not repeat. I'm trying to use it to return certain listing on static pages. Although this seems to work well there is one link always being returned 9 time out of 10. Since it's not really random enough with that one link always showing up I don't see how I can use it.
By looking at this global does anyone see why it's not returning all randomly?
sub {
my $tags = shift;
my $link_db = $DB->table('Links');
my $limit = $tags->{Random_Limit} || 4;
my ($output, $sth, $link);
$link_db->select_options ('ORDER BY RAND()', "LIMIT $limit");
$sth = $link_db->select ( { isValidated => 'Yes', galleries => 'Yes' });
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('gallery_table', $link);
}
return $output;
}
Called:
<%galleries1%>
<%loop galleries1_loop%>
<%endloop%>
Thanks for any help sorting this out
Jonze
By looking at this global does anyone see why it's not returning all randomly?
sub {
my $tags = shift;
my $link_db = $DB->table('Links');
my $limit = $tags->{Random_Limit} || 4;
my ($output, $sth, $link);
$link_db->select_options ('ORDER BY RAND()', "LIMIT $limit");
$sth = $link_db->select ( { isValidated => 'Yes', galleries => 'Yes' });
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('gallery_table', $link);
}
return $output;
}
Called:
<%galleries1%>
<%loop galleries1_loop%>
<%endloop%>
Thanks for any help sorting this out
Jonze