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

Global to return Random Category Name

Quote Reply
Global to return Random Category Name
Hi:

I wanted to write a global to return the Full Name of a Random Category... kind of a weird idea I had. Anyway, I played around with some code, and got as far as this, but was not completely working. Anyone want to see if they can spot my mistake?

Quote:


sub {
no strict;
my $db = $DB->table('Category');
my $total = $db -> count;
my $rand = int( rand($total) );
my $sth = $obj->select ( { ID => $rand } );
my $html = $sth->{'Full_Name'};
return $html;
}


Thanks!



dave
dave

Big Cartoon DataBase
Big Comic Book DataBase
Subject Author Views Date
Thread Global to return Random Category Name carfac 3201 Mar 21, 2002, 10:34 AM
Post Re: [carfac] Global to return Random Category Name
Stealth 3092 Mar 21, 2002, 10:54 AM
Thread Re: [carfac] Global to return Random Category Name
Paul 3097 Mar 21, 2002, 11:11 AM
Thread Re: [Paul] Global to return Random Category Name
carfac 3096 Mar 21, 2002, 11:20 AM
Thread Re: [carfac] Global to return Random Category Name
carfac 3125 Mar 21, 2002, 11:25 AM
Thread Re: [carfac] Global to return Random Category Name
Paul 3104 Mar 21, 2002, 11:27 AM
Thread Re: [Paul] Global to return Random Category Name
carfac 3094 Mar 21, 2002, 11:33 AM
Thread Re: [carfac] Global to return Random Category Name
Paul 3121 Mar 21, 2002, 12:01 PM
Post Re: [Paul] Global to return Random Category Name
carfac 3101 Mar 21, 2002, 12:17 PM