How do I make the links show randomly each time the page is refreshed/visited using the code:
sub {
my $tags = shift;
my ($cat_id, $cat_name) = each %{$DB->table('Links')->get_categories($tags->{ID})};
my $link_db = $DB->table('Links','CatLinks');
$link_db->select_options("ORDER BY RAND()","LIMIT 5");
my $sth = $link_db->select({ CategoryID => $cat_id });
my $output = '';
while (my $link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display('link', $link);
}
return $output;
}
The select_options above displays random links but I want the list to change each time the detailed page is visited/refreshed, showing another set of random links from the particular category.
Please help. Thanks
sub {
my $tags = shift;
my ($cat_id, $cat_name) = each %{$DB->table('Links')->get_categories($tags->{ID})};
my $link_db = $DB->table('Links','CatLinks');
$link_db->select_options("ORDER BY RAND()","LIMIT 5");
my $sth = $link_db->select({ CategoryID => $cat_id });
my $output = '';
while (my $link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display('link', $link);
}
return $output;
}
The select_options above displays random links but I want the list to change each time the detailed page is visited/refreshed, showing another set of random links from the particular category.
Please help. Thanks