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

Re: [Jagerman] last post global : well coded ?

Quote Reply
Re: [Jagerman] last post global : well coded ? In reply to
In Reply To:
select_options isn't meant to be used like that - generally, it's meant for ORDER BYs, LIMITs, but not for the WHERE clause - try instead:

$post_db->select_options ('ORDER BY post_time DESC', 'LIMIT 10');
my $sth = $post_db->select(GT::SQL::Condition->new(post_root_id => '=' => 0, forum_id_fk => '!=' => [7,8]));


Hi

txs for your answer

My global is now

sub {
my $tags = shift;
my $post_db = $DB->table ('Post');
$post_db->select_options ('ORDER BY post_time DESC', 'LIMIT 10');
my $sth = $post_db->select(GT::SQL::Condition->new(post_root_id => '=' => 0, forum_id_fk => '!=' => [7,8]));
my @output;
while (my $post = $sth->fetchrow_hashref)
{
push @output, $post;
}

return { post_loop => \@output };
}

It works except that this global displays some threads of all my forums... I don't understand because it shoudn't display the threads from my Forum '7' and my forum '8'...

any idea....

txs
FMP
Subject Author Views Date
Thread last post global : well coded ? fmp 3761 Mar 2, 2006, 1:17 AM
Thread Re: [fmp] last post global : well coded ?
Jagerman 3671 Mar 3, 2006, 3:41 PM
Post Re: [Jagerman] last post global : well coded ?
fmp 3634 Mar 5, 2006, 10:44 AM
Post Re: [Jagerman] last post global : well coded ?
fmp 3586 Apr 13, 2006, 2:29 PM
Post Re: [Jagerman] last post global : well coded ?
fmp 3543 Apr 23, 2006, 3:21 AM