Hrm... according to the DBI docs, execute() returns undef if it fails...
perhaps you should be using "if (defined($result)) { }"  ??  You might
also check for $DBI::errstr ...  I believe that only exists when there
is an error...

Are you sure your update is failing?

---------------------------
Jason H. Frisvold
Senior ATM Engineer
Engineering Dept.
Penteledata
CCNA Certified - CSCO10151622
[EMAIL PROTECTED]
---------------------------
"Imagination is more important than knowledge. Knowledge is limited.
Imagination encircles the world." -- Albert Einstein [1879-1955]


-----Original Message-----
From: Brown, Denise (CBS) [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, June 05, 2002 8:53 AM
To: Beginners@Perl. Org (E-mail)
Subject: Logfile isn't doing what I think it should do....(haha)

I'm having a problem getting my output to print to the LOGFILE as a
FAILED
UPDATE

Everything reports that "Updated waybill number..." ok even though I put
data that should fail in my input file.

What am I doing wrong?



        $sql_upd =3D "update bcerts_2001 set track_num=3D\'$track_num\'
";
        $sql_upd .=3D "where rsf_number=3D\'$rsf_num\'" ;
        printf "%s \n", $sql_upd ;
        $sth_upd =3D $dbh->prepare($sql_upd)
           || die "Cannot prepare sql_upd statement: $dbh->errstr" ;
        $result =3D $sth_upd->execute ();
            if ($result) {
                  printf LOGFILE "Updated waybill number $rsf_num  =
$track_num \n";
                    } else {
            printf LOGFILE "FAILED UPDATE, $rsf_num, $track_num,
$name,$add=
1, $add2, $add3,  $add4, $add5 \n" ;
            printf EXCFILE "$sql_upd \n";
                    }           # end if result
        $result =3D $sth_upd->finish
            || die "Can't finish sql_sel statement: $dbh->errstr";
}
        $result =3D $dbh->disconnect
        || die "Can't disconnect from database: $dbh->errstr";
close LOGFILE;
close EXCFILE;
exit;


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


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

Reply via email to