JasonB has asked for the wisdom of the Perl Monks concerning the following question:
sub { my $sth; my $cat_db = $DB->table('Category'); $cat_db->select_options ("ORDER BY RAND()", "LIMIT $_[0]"); my $sth = $cat_db->select ( { FatherID => 4}, ['Full_Name','Name'] ); my @output; while (my $cat = $sth->fetchrow_hashref) { if (length $cat->{Name} > 23) { $cat->{Name} = substr($cat->{Name}, 0, 23) . '..'; } $cat->{URL} = "$CFG->{build_root_url}/" . $cat_db->as_url($cat->{Full_ +Name}) . "/"; push @output, $cat; } return {catrand => \@output}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Applying ASC sort with RAND?
by ikegami (Patriarch) on Apr 17, 2007 at 20:38 UTC | |
|
Re: Applying ASC sort with RAND?
by shmem (Chancellor) on Apr 17, 2007 at 18:09 UTC | |
by JasonB (Initiate) on Apr 17, 2007 at 19:14 UTC | |
|
Re: Applying ASC sort with RAND?
by Moron (Curate) on Apr 17, 2007 at 20:29 UTC |