CREATE TABLE `cookie` (
`id` int(255) NOT NULL auto_increment,
`names` text NOT NULL,
`counts` int(255) NOT NULL default '1',
PRIMARY KEY (`id`),
KEY `blbnoidx` (`id`)
) ENGINE=MyISAM ;
opac-main.pl
my $dbh = C4::Context->dbh;
my $top="Select names,SUM(counts) \"co\" from cookie group by names order by co desc limit 0 , 10";
my $sth=$dbh->prepare($top);
$sth->execute;
my @top;
my $top;
while (my ($names,$counts) = $sth->fetchrow_array) {
my %rows = ( searchterm => $names,
counts => $counts,
);
push @top, \%rows;
}
$sth->finish;
$template->param(top => \@top)
----------------------------------------------
opac-main.tmpl
"> ()
----------------------------------------------
opac-search.pl
# put into cookie
for my $count (@value) {
my $dbh=C4::Context->dbh;
$sth = $dbh->prepare("insert into cookie(names) values (?)");
$sth->execute($count) || die $sth->errstr;
}
沒有留言:
張貼留言