Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Links Custom Sort - part 2 (For Alex)

Quote Reply
Links Custom Sort - part 2 (For Alex)
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.

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 }


}
Quote Reply
Re: [AMIXIMA] Links Custom Sort - part 2 (For Alex) In reply to
Andy I am sorry, I meant Andy not Alex.
Quote Reply
Re: [AMIXIMA] Links Custom Sort - part 2 (For Alex) In reply to
Try changing:

Code:
my $tbl = $DB->table('Links');

to

Code:
my $tbl = $DB->table('CatLinks','Links');

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 (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Links Custom Sort - part 2 (For Alex) In reply to
Thank you, it works now!