Gossamer Forum
Home : Products : Gossamer Links : Discussions :

new link global

Quote Reply
new link global
Hi all,

Using the following global to list the 20 newest links:

sub {
my $tags = shift;
my $table = $DB->table('Links');
$table->select_options ('ORDER BY Add_Date DESC', 'LIMIT 20');
my $sth = $table->select;
my $output;
while (my $link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link', $link)
}
return $output;
}

Unfortunately, when the list appears, it contains links that have not been validated. How can the code be modified so as not to include the non-validated links?

Thanks.
Quote Reply
Re: [OP] new link global In reply to
You need to add a where clause:

isValidated=>'Yes'

Take a look at the jump.pm or search routines to see how to do it.

ex: my $sth = $db->select ( { isValidated => 'Yes' }, ['ID', 'URL'] );

In your case, perhaps:

my $sth = $table->select ({isValidated => 'Yes'});


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.