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
Subject Author Views Date
Thread GT::SQL::Condition help hagai 3263 Mar 26, 2008, 9:12 AM
Post Re: [hagai] GT::SQL::Condition help
Andy 3195 Mar 26, 2008, 9:23 AM