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

query -> number of results

Quote Reply
query -> number of results
I have a global to search Links table and it works fine.

sub {
my $tags = shift;
my $query = $tags->{query};
my $search_db = $DB->table('Links');
$search_db->select_options ("ORDER BY $CFG->{build_sort_order_category}");

my $sth = $search_db->query_sth ( {
isValidated => 'Yes',
query => $query,
ma => 1,
nh => 1,
mh => 10
} );

my @output;
while (my $link = $sth->fetchrow_hashref) {
push (@output, $link);
}
return { query_search_results_loop => \@output };
}


On site i use:

<%name_of_the_global%>

<%loop query_search_results_loop%>
<%include link.html%>
<%endloop%>




My problem is:

I have limited the number of results to 10 (with mh => 10)
but I would like to know the number of available results if the number exceeds 10.

Thanks in advance!

Last edited by:

Payooo: Nov 7, 2006, 12:32 PM
Quote Reply
Re: [Payooo] query -> number of results In reply to
Anybody?
Quote Reply
Re: [Payooo] query -> number of results In reply to
Hi,

Maybe something like this?

Code:
my $total = $search_db->query_sth ( {
isValidated => 'Yes',
query => $query,
ma => 1,
} );

Also, any reason your doing it through query_sth and not select() .. i.e $DB->table('Links')->select( GT::SQL::Condition->new(....) )

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 | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!