This is based off some code Paul posted a while back. I'm trying to pull a top list from a set of daily searches using the Improved Search Logger plugin. Can someone tell me what I'm doing wrong? I keep getting the error:
Can't call method "fetchrow_hashref" on an undefined value at (eval 369) line 16.
# -----------------------------------------------
# Returns a list of the daily Top 10 Searched terms.
# Gets the current date.
Links::init_date();
GT::Date::date_set_format($CFG->{'date_db_format'});
my $date = GT::Date::date_get();
my (@output,$db,$sth);
$db = $DB->table('SearchLogDaily');
$db->select_options ('ORDER BY HitCount DESC', 'WHERE Hit_Date = \"$date\"', 'LIMIT 10');
$sth = $db->select;
while (my $row = $sth->fetchrow_hashref) {
push @output, qq~<a href="$CFG->{db_cgi_url}/search.cgi?query=$row->{Term}">$row->{Term}</a>~;
}
return $#output > -1 ? join('<br>', @output) : 'No terms yet!';
}
Thanks upfront...
Sean
Can't call method "fetchrow_hashref" on an undefined value at (eval 369) line 16.
Code:
sub { # -----------------------------------------------
# Returns a list of the daily Top 10 Searched terms.
# Gets the current date.
Links::init_date();
GT::Date::date_set_format($CFG->{'date_db_format'});
my $date = GT::Date::date_get();
my (@output,$db,$sth);
$db = $DB->table('SearchLogDaily');
$db->select_options ('ORDER BY HitCount DESC', 'WHERE Hit_Date = \"$date\"', 'LIMIT 10');
$sth = $db->select;
while (my $row = $sth->fetchrow_hashref) {
push @output, qq~<a href="$CFG->{db_cgi_url}/search.cgi?query=$row->{Term}">$row->{Term}</a>~;
}
return $#output > -1 ? join('<br>', @output) : 'No terms yet!';
}
Thanks upfront...
Sean