Hi,
You would actually need to do a little bit more changing than that - but you're on the right line rascal =)
These should work:
sub {
my ($output,$db,$sth);
my $db = $DB->table('SearchLogs');
$db->select_options ('ORDER BY slog_count DESC', 'LIMIT 5');
$sth = $db->select;
while (my $row = $sth->fetchrow_hashref) {
$output .= qq~* <a href="$CFG->{db_cgi_url}/search.cgi?query=$row->{slog_query}">$row->{slog_query}</a><br>~;
}
$output ? return $output : return 'No terms yet!';
}
sub {
my ($output,$db,$sth);
my $db = $DB->table('SearchLogs');
$db->select_options ('ORDER BY slog_last DESC', 'LIMIT 5');
$sth = $db->select;
while (my $row = $sth->fetchrow_hashref) {
$output .= qq~* <a href="$CFG->{db_cgi_url}/search.cgi?query=$row->{slog_query}">$row->{slog_query}</a><br>~;
}
$output ? return $output : return 'No terms yet!';
}
The main bits were the ORDER BY .. , as those fields differed too.
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!
You would actually need to do a little bit more changing than that - but you're on the right line rascal =)
These should work:
Code:
Top search words: sub {
my ($output,$db,$sth);
my $db = $DB->table('SearchLogs');
$db->select_options ('ORDER BY slog_count DESC', 'LIMIT 5');
$sth = $db->select;
while (my $row = $sth->fetchrow_hashref) {
$output .= qq~* <a href="$CFG->{db_cgi_url}/search.cgi?query=$row->{slog_query}">$row->{slog_query}</a><br>~;
}
$output ? return $output : return 'No terms yet!';
}
Code:
Last searched words: sub {
my ($output,$db,$sth);
my $db = $DB->table('SearchLogs');
$db->select_options ('ORDER BY slog_last DESC', 'LIMIT 5');
$sth = $db->select;
while (my $row = $sth->fetchrow_hashref) {
$output .= qq~* <a href="$CFG->{db_cgi_url}/search.cgi?query=$row->{slog_query}">$row->{slog_query}</a><br>~;
}
$output ? return $output : return 'No terms yet!';
}
The main bits were the ORDER BY .. , as those fields differed too.
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!