Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Why isn't Global returning random?

Quote Reply
Why isn't Global returning random?
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

Last edited by:

Jonze: Feb 19, 2003, 1:39 PM
Subject Author Views Date
Thread Why isn't Global returning random? Jonze 2226 Feb 19, 2003, 1:38 PM
Thread Re: [Jonze] Why isn't Global returning random?
pugdog 2183 Feb 19, 2003, 11:02 PM
Thread Re: [pugdog] Why isn't Global returning random?
Jonze 2155 Feb 20, 2003, 2:13 PM
Thread Re: [Jonze] Why isn't Global returning random?
Alex 2132 Feb 26, 2003, 12:24 AM
Post Re: [Alex] Why isn't Global returning random?
Jonze 2109 Feb 26, 2003, 10:56 PM