Gossamer Forum
Home : Products : Gossamer Links : Discussions :

random link

Quote Reply
random link
Does anyone know how you can set random link to not choose links from certain categorys. this is because i do not want the random link to load up links from the adult category of our links directory.



Any ideas??



thanks, ian rollinson
Quote Reply
Re: [irollinson] random link In reply to
Something like:

Code:
require GT::SQL::Condition;

my $rand = int ( rand ( $DB->table('Links')->count ) );
my @bad = qw/Adult/;
my $cond = GT::SQL::Condition( 'Category.Name', 'NOT IN', \@bad, 'Links.ID', '=', $rand );
my $link = $DB->table('Links','Category')->select($cond)->fetchrow_hashref;

Last edited by:

Paul: Aug 3, 2002, 8:57 AM
Quote Reply
Re: [Paul] random link In reply to
where abouts would i put that code?
Quote Reply
Re: [irollinson] random link In reply to
Your answer is here http://www.gossamer-threads.com/...rum.cgi?post=174933;