sub suchen { my $db="DBI:mysql:produkte"; my $user=""; my $pass=""; my $dbh = DBI->connect($db,$user,$pass) or die $DBI::errstr; my $statement_suchen="SELECT * FROM tbl0011990 where ident_nr = '$identnr'"; my $sth_suchen=$dbh->prepare($statement_suchen) or die $DBI::errstr; $sth_suchen->execute; my %hash; while (my @row = $sth_suchen->fetchrow_array()) { $hash{identnr} = $row[0]; $hash{doctyp} = $row[2]; $hash{docname} = $row[3]; $hash{head_de} = $row[4] if ($row[1] eq 'DE'); $hash{head_en} = $row[4] if ($row[1] eq 'EN'); $hash{head_fr} = $row[4] if ($row[1] eq 'FR'); $hash{deutsch} = $row[5] if ($row[1] eq 'DE'); $hash{englisch} = $row[5] if ($row[1] eq 'EN'); $hash{franz} = $row[5] if ($row[1] eq 'FR'); $hash{ersteller}= $row[7]; $hash{werk} = $row[8]; $hash{check1} = $row[9]; $hash{check2} = $row[10]; $hash{check3} = $row[11]; $hash{check4} = $row[12]; } my $stmt_docnames = "SELECT docnames FROM tbl0011990 WHERE ident_nr = ?"; my $sth_docnames = $dbh->prepare($stmt_docnames) or die $dbh->errstr(); $sth_docnames->execute() or die $dbh->errstr(); my %hash_docs; while(my ($doc) = $sth_docnames->fetchrow_array()){ $hash_docs{$doc}++; } if(scalar(keys(%hash_docs)) > 1){ doc_vorhanden(%hash_docs); } else{ such_eintr(\%hash); } $sth_suchen->finish(); $dbh->disconnect(); }