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 4254 Mar 21, 2002, 10:34 AM
Post Re: [carfac] Global to return Random Category Name
Stealth 4099 Mar 21, 2002, 10:54 AM
Thread Re: [carfac] Global to return Random Category Name
Paul 4103 Mar 21, 2002, 11:11 AM
Thread Re: [Paul] Global to return Random Category Name
carfac 4107 Mar 21, 2002, 11:20 AM
Thread Re: [carfac] Global to return Random Category Name
carfac 4140 Mar 21, 2002, 11:25 AM
Thread Re: [carfac] Global to return Random Category Name
Paul 4121 Mar 21, 2002, 11:27 AM
Thread Re: [Paul] Global to return Random Category Name
carfac 4113 Mar 21, 2002, 11:33 AM
Thread Re: [carfac] Global to return Random Category Name
Paul 4138 Mar 21, 2002, 12:01 PM
Post Re: [Paul] Global to return Random Category Name
carfac 4108 Mar 21, 2002, 12:17 PM