Update:
I think I may be closer than I thought!
In the original code, I *thought* I was
bringing back the entire select output.
I *believe* I was only bringing in one row.
I am trying to recreate it by testing from
another table. It brings the first row; but
now, the 'fetchrow' part of it *seems* to be working,
but it's only 'fetching ONE row'...
How do I bring back an entire array / list from the
select statement I just made?
[code]
#!/usr/bin/perl
$debug=2;
# Attempting to edit this so that email can be
# set to user community (from sys_users) without
# needing to get a list of users and THEN emailing them
# created 14 Dec 01 -X
use CGI qw(:standard);
use Pg;
require "/var/www/hminclude.pl";
$conn=dbOpen("dbname=database");
# hopefully, this get my column of email addresses
# and puts it into an array for me to use later
$contract=doquery('Contract Members',"
select contract
from mbr");
($contract)=$contract->fetchrow;
$users=doquery('Email Community',"
SELECT email
FROM users
WHERE email ~* '[a-z]'
ORDER BY upper(email) ");
($users)=$users->fetchrow;
#while (($email)=$users->fetchrow) {
# $new_users=$users;
#};
# set the date
open DATE, "date |";
$date=<DATE>;
chop $date;
# should be the address of sender and users
$addr='[EMAIL PROTECTED]';
$users=$result;
#$message=param('message');
$boundary='!*@&#^$% Apache web server MIME boundary %$^#&@*!';
open MAIL, "|/usr/lib/sendmail -oi -t -odq "
|| print "no sendmail\n";
print MAIL <<EOF
From: "Apache Webserver" <admin\@domain.com>
To: $addr
Date: $date
Subject: Apache mailing list request
Mime-Version: 1.0
Content-type: multipart/mixed;
Boundary="$boundary"
Content-Disposition: inline
--$boundary
ontent-type: text/html; charset=us-ascii
Content-Disposition: inline
This is a list or message that would go to the list
of users if we need to send them something.
For your reference, the query executed is shown below:
#$new_users
$users
$contract
EOF
;
close(MAIL) || print "can't close mail\n";
print "mail has been sent\n";
__END__
[/code]
TIA
-X