on do, 27 feb 2003 16:57:59 GMT, Scot Robnett wrote:

> I have a script which is supposed to e-mail a user their
> username/password info as long as their e-mail address is in the
> database. The following code works if the address is in the database
> (it prints the approval page and sends the mail with the correct
> information), but if the address is -not- in the database I get a 500
> error. 

I would do the following (untested!):

    my $email = $q->param('forgotten_password_email');
    my ($username, $password) = $dbh->selectrow_array(qq{
        SELECT
            UserName,
            UserPass 
        FROM UserData
        WHERE EmailAddress = ?
    }, undef, $email);

    if ($username && $password) {
       # email the new password and show confirmation
    } else {
       # show 'email address not found' message
    }


-- 
felix

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

Reply via email to