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

Global to list links without reviews

Quote Reply
Global to list links without reviews
I'm trying to write a global to select 20 random links without reviews. I have worked out the SQL statement required but am having trouble getting it to return anything in Links:

Code:
sub {
# Displays 20 random links with no review
my ($output,$sth,$link);
my $search_db = $DB->table('Links', 'Reviews');
$search_db->select_options ('ORDER BY RAND()', 'LIMIT 20');
$sth = $search_db->select (GT::SQL::Condition->new('isValidated', '=',' Yes', 'Review_LinkID', 'IS', 'NULL'));
while ($link = $sth->fetchrow_hashref) {
if (length $link->{Title} > 26) {
$link->{Titleshort} = substr($link->{Title}, 0, 25) . '...';
}
$output .= Links::SiteHTML::display ('templatename', $link);
}
return $output;
}

I suspect the 'Review_LinkID is NULL' part is the problem, nothing I have tried has worked. Any suggestions appreciated Smile.
Subject Author Views Date
Thread Global to list links without reviews aus_dave 4434 May 17, 2007, 4:03 AM
Thread Re: [aus_dave] Global to list links without reviews
Andy 4327 May 17, 2007, 6:55 AM
Thread Re: [Andy] Global to list links without reviews
aus_dave 4330 May 17, 2007, 3:01 PM
Thread Re: [aus_dave] Global to list links without reviews
Andy 4316 May 19, 2007, 2:50 AM
Thread Re: [Andy] Global to list links without reviews
aus_dave 4313 May 19, 2007, 4:14 AM
Thread Re: [aus_dave] Global to list links without reviews
Andy 4305 May 22, 2007, 1:23 AM
Thread Re: [Andy] Global to list links without reviews
aus_dave 4251 May 31, 2007, 7:21 PM
Post Re: [aus_dave] Global to list links without reviews
Andy 4264 Jun 1, 2007, 3:09 AM