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

Need help with global condition statement >>

Quote Reply
Need help with global condition statement >>
Yo

Just when I thought I had this global beat, I find another problem. I just can't seem to get the following condition statement working:

my $cond = GT::SQL::Condition->new('content_url1', 'IS NOT', \'NULL');

I would like it to return only links with their 'content_url1' field filled. Below is the global I'm working on which works great except for still returning links with the 'content_url' field empty. I'm not even really sure if thats the correct way to write the statement.

If someone could offer some help or suggestions I'd greatly appricate it.

sub {
my $tags = shift;
my $link_db = $DB->table('Links');
my $limit = $tags->{Random_Limit} || 4;
my ($output, $sth, $link);
require GT::SQL::Condition;
my $cond = GT::SQL::Condition->new('content_url1', 'IS NOT', \'NULL', 'isValidated','=','Yes', 'has_content','=','Yes');
$link_db->select_options ( 'ORDER BY RAND(NOW())', "LIMIT $limit");
$sth = $link_db->select ($cond);
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('content_table', $link);
}
return $output;
}
Quote Reply
Re: [Jonze] Need help with global condition statement >> In reply to
You refer to 'content_url' in the description of the problem, but in your codes you refer to 'content_url1' ... isd it just a typo?


----------
my $cond = GT::SQL::Condition->new('content_url1', 'IS NOT', \'NULL');

....I would like it to return only links with their 'content_url1' field filled...
----------

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Need help with global condition statement >> In reply to
Oh, that's just a typo. Yes, content_url1 is what I'm using.

I Was working late last night so I'm suprised that's the only one.

Can ya see anything wrong Andy?? Wink Anyone?
Quote Reply
Re: [Jonze] Need help with global condition statement >> In reply to
Try:

Code:
my $cond = GT::SQL::Condition->new('content_url1', 'IS NOT', \'NULL', 'content_url1', '<>', '');

Last edited by:

Paul: Feb 24, 2003, 7:33 AM
Quote Reply
Re: [Paul] Need help with global condition statement >> In reply to
That did the trick Paul. Thanks for your help! Wink

I was actually able to just use: 'content_url1', '<>', ''

Knowing how to use these types of conditions can come in very handy. I'm happy to say I was finally able to get this new feature of mine completly working. Really wasn't sure it was going to happen.

Thanks again.