# untested sub member exists { my ($dbh, $email, $mid) = @_; my $query = qq{ SELECT COUNT(*) FROM ML_Subscribers WHERE S_Email = ? AND MID = ? }; my $sth = $dbh->prepare($query); $sth->execute ($email, $mid); my ($count) = $sth->fetchrow_array(); $sth->finish(); return $count; } my $dbh = DBI->connect("blah blah blah") or die "..."; print "Joe exists\n" if member_exists($dbh, "joe", 12); print "Fred is there\n" if member_exists($dbh, "fred", 16); # the rest of your application here. $dbh->disconnect; #### _ _ _ _ (_|| | |(_|>< _|