Gossamer Forum
Quote Reply
GT::SQL::Condition help
I need some help with GT::SQL

im trying to write the following query:
Code:

SELECT * FROM glinks_Links WHERE ID = '$linkID' OR (LinkOwner = '$linkowner' AND LinkOwner <> 'admin');

heres what i have so far, but i think it might be wrong
Code:
my $db = $DB->table('Links');
my $cond1 = GT::SQL::Condition->new(
"LinkOwner", "=",$tags->{LinkOwner},
"LinkOwner", "<>", "admin");
my $cond2 = GT::SQL::Condition->new($cond1,"ID", "=",$tags->{ID});
$cond2->bool("or");
my $sth = $db->select ( $cond2 );

Can anyone confirm that this code is correct or if incorrect modify the code to make it correct.

Thanks,

Hagai
Quote Reply
Re: [hagai] GT::SQL::Condition help In reply to
Hi,

As far as I can see, that should work Smile

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!