sub set_unread{ my $threadID = shift; my $sth = $dbh->prepare(q{SELECT account_id FROM forum_accounts}); $sth->execute(); my @erg; while (my $zeile = $sth->fetchrow_hashref()){ push(@erg,$zeile); } $sth->finish; foreach(@erg){ unless( $_->{account_id} == $main::acc_ID){ $sth = $dbh->prepare(q{ CALL insert_forum_unread(?,?)}); $sth->execute($_->{account_id}, $threadID); $sth->finish; } } }