my $user = $main->{current_user}; my $dbh = DBI->connect("$db_name","$db_user","$db_pass") || die "Database connection not made: $DBI::errstr"; my $sth = $dbh->prepare("SELECT * FROM pm_in WHERE pm_to = '$user->{name}' AND new = '1'"); $sth->execute(); my @count = $dbh->selectrow_array(q{SELECT COUNT(1) FROM pm_in WHERE pm_to=? and new=1}, undef, $user->{name}); my $output = $main->createInfoOutput('newmails',{mails => $count[0]}); return [$output]; $sth->finish(); $dbh->disconnect();