Hi Andy
I actually use this function:)
And I it not give me error when I try it.
sub {
use GT::SQL::Condition;
my $user = $_[0];
my $id = $_[1];
my $catid = $_[2];
my $tbl = $DB->table('CatLinks','Links');
$tbl->select_options('ORDER BY Add_Date DESC Limit 10');
my $cond = new GT::SQL::Condition;
$cond->add('isValidated','=','Yes');
$cond->add(Cast => Like => "%$user%");
if ($catid) {
my $all_ids = $DB->table('Category')->children($catid);
$cond->add('CategoryID','IN',\@$all_ids); }
my $sth = $tbl->select( $cond ) || return $GT::SQL::error;
my $seen;
my @back;
while (my $hit = $sth->fetchrow_hashref) {
if ($seen->{$link->{ID})) { next };
$seen->{$link->{ID}) = 1;
push @back, $hit;
} my $exists; if ($back[0]) { $exists = 1; } else { $exists = ''; }
return { user_link_loop => \@back, exists => $exists }; }
I actually use this function:)
And I it not give me error when I try it.
sub {
use GT::SQL::Condition;
my $user = $_[0];
my $id = $_[1];
my $catid = $_[2];
my $tbl = $DB->table('CatLinks','Links');
$tbl->select_options('ORDER BY Add_Date DESC Limit 10');
my $cond = new GT::SQL::Condition;
$cond->add('isValidated','=','Yes');
$cond->add(Cast => Like => "%$user%");
if ($catid) {
my $all_ids = $DB->table('Category')->children($catid);
$cond->add('CategoryID','IN',\@$all_ids); }
my $sth = $tbl->select( $cond ) || return $GT::SQL::error;
my $seen;
my @back;
while (my $hit = $sth->fetchrow_hashref) {
if ($seen->{$link->{ID})) { next };
$seen->{$link->{ID}) = 1;
push @back, $hit;
} my $exists; if ($back[0]) { $exists = 1; } else { $exists = ''; }
return { user_link_loop => \@back, exists => $exists }; }