Hi,
I'm using this global to show gforum posts on homepage.
my $limit = shift;
$limit = 10 if (ref $limit); ## the template parser has a nasty habit of passing in a hash_ref of all tags if no
use lib '/admin';
use GT::SQL;
my $DB_GFORUM = GT::SQL->new('/admin/defs');
my $posts_table = $DB_GFORUM->table('Post'); ## now, create a table object to that new $DB object
$posts_table->select_options("ORDER BY post_latest_reply", "LIMIT $limit"); ## set the select options to order the results to pick off the newest
#my $sth = $posts_table->select('post_id', 'post_subject', 'post_time' => { post_root_id => 0 } );
my $sth = $posts_table->select( ['post_id','post_subject','post_time'] , { post_root_id => 0 } , { forum_id_fk => 3 } ) || die $GT::SQL::error;
use GT::Date qw/date_get/;
my @output;
while (my $post = $sth->fetchrow_hashref) {
$post->{post_time} = date_get($post->{post_time});
push @output, $post;
}
return { GForum_loop => \@output} ; ## return the dereferenced array, the actual data as a tag called <%GForum_loop%>
}
Now, this code catch all post from Gforum ID 3. I want to display everything but Gforum ID 3. I've tried something like forum_id_fk !=> 3 and forum_id_fk != 3 but that doesn't work.
How to use "NOT" in GT:SQL module?
Regards.
UnReal Network
I'm using this global to show gforum posts on homepage.
Code:
sub { my $limit = shift;
$limit = 10 if (ref $limit); ## the template parser has a nasty habit of passing in a hash_ref of all tags if no
use lib '/admin';
use GT::SQL;
my $DB_GFORUM = GT::SQL->new('/admin/defs');
my $posts_table = $DB_GFORUM->table('Post'); ## now, create a table object to that new $DB object
$posts_table->select_options("ORDER BY post_latest_reply", "LIMIT $limit"); ## set the select options to order the results to pick off the newest
#my $sth = $posts_table->select('post_id', 'post_subject', 'post_time' => { post_root_id => 0 } );
my $sth = $posts_table->select( ['post_id','post_subject','post_time'] , { post_root_id => 0 } , { forum_id_fk => 3 } ) || die $GT::SQL::error;
use GT::Date qw/date_get/;
my @output;
while (my $post = $sth->fetchrow_hashref) {
$post->{post_time} = date_get($post->{post_time});
push @output, $post;
}
return { GForum_loop => \@output} ; ## return the dereferenced array, the actual data as a tag called <%GForum_loop%>
}
Now, this code catch all post from Gforum ID 3. I want to display everything but Gforum ID 3. I've tried something like forum_id_fk !=> 3 and forum_id_fk != 3 but that doesn't work.
How to use "NOT" in GT:SQL module?
Regards.
UnReal Network