#!/usr/bin/perl
#!/usr/local/bin/perl
######################################################
# Hot Links SQL - searchfeed.com Search Results
######################################################
use CGI;
use DBI;
require 'config.pl'; # you may need to specify the full path
my $q = CGI->new;
print $q->header;
print <<"HTML";
document.write(\"
\");
document.write(\"\");
document.write(\"\");
document.write(\" Top Searches | \");
HTML
my $dbh = DBI->connect("DBI:mysql:$dbname;$dbhost", $dblogin, $dbpass) || print "Could not connect to database ";
my $sth = $dbh->prepare("SELECT keywords FROM search WHERE keywords != '' ORDER BY count DESC") || print "could not access database";
$sth->execute();
while (my $results = $sth->fetchrow_hashref) {
my $keywords = $results->{keywords};
$count_keys++;
if ($count_keys <= $topsearchcount) {print " document.write(\"| $keywords | \"); ";} else {last;}
}
$sth->finish;
$dbh->disconnect;
print <<"HTML";
document.write(\" \");
document.write(\" |
\");
HTML