heya Guys and Gals!
I need just alittle help.....
i would like to exit out to an error page if perl detects a duplicate record.
heres my script:
my $dsn = "DBI:mysqlPP:TTC:$DB::SERVER";
my $dbh = DBI->connect($dsn, $DB::USER, $DB:ASS);
my $sth = $dbh->prepare(qq{
INSERT INTO caller
VALUES ('$TT::CALLINBY', '$TT::CALLLOCATION', '$TT::CALLPHONE', '$TT::CALLEMAIL')
});
$sth->execute();
if (ERROR EXISTS) { DO THIS }
$sth->finish();
$dbh->disconnect();
Im not quite sure how i could pull the error message then act on it. Here is the error i get:
DBD::mysqlPP::st execute failed: Duplicate entry 'Gary Freeman' for key 1 at C:\create.pl line 226.
Thanks in advanced!
- Scott
I need just alittle help.....
i would like to exit out to an error page if perl detects a duplicate record.
heres my script:
my $dsn = "DBI:mysqlPP:TTC:$DB::SERVER";
my $dbh = DBI->connect($dsn, $DB::USER, $DB:ASS);
my $sth = $dbh->prepare(qq{
INSERT INTO caller
VALUES ('$TT::CALLINBY', '$TT::CALLLOCATION', '$TT::CALLPHONE', '$TT::CALLEMAIL')
});
$sth->execute();
if (ERROR EXISTS) { DO THIS }
$sth->finish();
$dbh->disconnect();
Im not quite sure how i could pull the error message then act on it. Here is the error i get:
DBD::mysqlPP::st execute failed: Duplicate entry 'Gary Freeman' for key 1 at C:\create.pl line 226.
Thanks in advanced!
- Scott