my $sql = "select type from bilder where id =?"; my $sth = $dbh->prepare($sql); $sth->execute( $q->param('id') ); my $error = 0; my $type = $sth->fetchrow || ( $error = 1 ); $sql = "select data from bilder where id =?"; $sth = $dbh->prepare($sql); $sth->execute( $q->param('id') ); my $data = $sth->fetchrow(); binmode(STDOUT); ...