Hi Alex,
There is an error in the script.
----------------------------
A fatal error has occured:
Failed to execute query: 'SELECT * FROM glinks_Links WHERE (isValidated = ?) AND CatLinks.CategoryID = ? ORDER BY N_State_Rank ASC LIMIT 10': Unknown column 'CatLinks.CategoryID' in 'where clause' at (eval 36) line 24.
Please enable debugging in setup for more details.
----------------------------
Could you please revisit?
Thanks.
my ($limit,$sort_order,$cat_id) = (shift,shift,shift);
my @queries = @_;
$sort_order ||= "Title ASC";
my $tbl = $DB->table('Links');
if ($limit) {
$tbl->select_options(qq|ORDER BY $sort_order LIMIT $limit|);
} else {
$tbl->select_options(qq|ORDER BY $sort_order|);
}
my $cond = new GT::SQL::Condition;
foreach (@queries) {
my ($field,$operator,$val) = split /::/;
$cond->add($field,$operator,$val);
}
$cond->bool("AND");
my $sth = $tbl->select( $cond, { 'CatLinks.CategoryID' => $cat_id } ) || die $GT::SQL::error;
my @loop;
while (my $hit = $sth->fetchrow_hashref) {
$hit = Links::SiteHTML::tags('link', $hit);
push @loop, $hit;
}
return { cond_loop_link => \@loop }
}
There is an error in the script.
----------------------------
A fatal error has occured:
Failed to execute query: 'SELECT * FROM glinks_Links WHERE (isValidated = ?) AND CatLinks.CategoryID = ? ORDER BY N_State_Rank ASC LIMIT 10': Unknown column 'CatLinks.CategoryID' in 'where clause' at (eval 36) line 24.
Please enable debugging in setup for more details.
----------------------------
Could you please revisit?
Thanks.
Code:
sub { my ($limit,$sort_order,$cat_id) = (shift,shift,shift);
my @queries = @_;
$sort_order ||= "Title ASC";
my $tbl = $DB->table('Links');
if ($limit) {
$tbl->select_options(qq|ORDER BY $sort_order LIMIT $limit|);
} else {
$tbl->select_options(qq|ORDER BY $sort_order|);
}
my $cond = new GT::SQL::Condition;
foreach (@queries) {
my ($field,$operator,$val) = split /::/;
$cond->add($field,$operator,$val);
}
$cond->bool("AND");
my $sth = $tbl->select( $cond, { 'CatLinks.CategoryID' => $cat_id } ) || die $GT::SQL::error;
my @loop;
while (my $hit = $sth->fetchrow_hashref) {
$hit = Links::SiteHTML::tags('link', $hit);
push @loop, $hit;
}
return { cond_loop_link => \@loop }
}