Hello, God bless you.

On Mon, Oct 07, 2002 at 03:16:34AM +0200, Sven Bentlage wrote:
> Hi everyone,
> 
(..cuts...)
> Any help or hints would be greatly appreciated.
> 

May be ordering the dataset by user could help, add it in the select
statament (obviously this can be cumbersome if the table is big, this
is optional). And adding a special error email address and/or looping
on users without email address could help.

> my $dbh = DBI->connect( $dsn, $db_user, $db_pass ) || die "danger 
> $DBI::errstr\n";
> my $sth = $dbh->prepare( "select * from memberscopy " );

my $sth = $dbh->prepare( "select * from memberscopy order by <USER> " );

Of course replace <USER> by the name of the field that uniquely
identify your user in the table.

> $sth->execute();
> while (($id, $surname, $name, $count_res, $E_cont_e, $E_cont_f, $rank, 
> $cname, $caddress, $ctel,
>               $cfax, $cmobile, $cemail, $curl, $btype, $hq, $quali, 
>               $experi, $inhouse, $resid, $ptel, $pfax,
>               $pmobile, $pemail, $birthday, $marital, $spouse, 
>               $children_names, $children_number, $hobbies,
>               $membership, $pcont, $permtel, $permfax, $course, $nation, 
>               $lastup, $loginid, $password,
>               $japan_row, $E_membership_paid, $E_membership_expires,
>               $face) = $sth->fetchrow_array ) {
>               

In your statements below, there is an error in wich, if the user let's
it's 3 email addresses fields empty, then the previous recipient will
get the email. So, you may want to change:

>               unless ($E_cont_e eq "") {my $recipient = $E_cont_e }
>               else {
>                        if ($pemail ne "") { $recipient = $pemail }
>                        elsif ($cemail ne "") { $recipient = $cemail }
>                        }      

 to

    if ($E_cont_e ne "") {
        $recipient = $E_cont_e;
    } elsif ($pemail ne "") {
        $recipient = $pemail;
    } elsif ($cemail ne "") {
        $recipient = $cemail;
    } else {
        # User don't supplied us with his/her email address, take
        # action.

        # And here you can loop uncomenting the next line:
        #next;

        # or, send the info to yourself or the admin of the data base
        # so you know and can take action regarding the information of
        # this user.
        $recipient = '[EMAIL PROTECTED]';
    }

> 
> #below here is only MIME::LITE sending the email      
> 
> }

So now, $recipient allways have the email address of the user owning
the data, or your email address so you can check your user information
and ask him/her to correct his/her personal information record to add
an email address.

See you, hth
Roberto Ruiz

ps. sorry for my bad English.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to