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 = '$nick' AND new = '1' ORDER BY date DESC"); $sth->execute(); my $count=0; while(my @entries = $sth->fetchrow_array){ print "Datensatz: @entries\n"; $count++; } #my $output = $main->createInfoOutput('newmails',{mails => $sth}); $sth->finish(); $dbh->disconnect();