I need some help with GT::SQL
im trying to write the following query:
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
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
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