On Sat, 18 Jan 2003 at 17:45, Hughes, Andrew opined: [reply cc'd to list]
HA:DBD::mysql::db do failed: Duplicate entry '[EMAIL PROTECTED]' for HA:key 2 at nCSSW.pl line 787. HA: HA:I know that you tried to point me in the right direction with the code HA:snippet that you suggested. However, as I am relatively new to all this, I HA:cannot seem to make use of the error and perform decisions in the script HA:based on it. [snip] HA:Can anyone offer any suggestions on where I can find info on how to retreive HA:a database error message and make decisions on it in this context? wrap your execute() inside an eval, then examine $@. see below: HA:eval { HA: $sth->execute('[EMAIL PROTECTED]'); HA:}; HA: HA:if ($@) { HA: warn "error - probably a violation of the unique constraint"; HA: # return something to the user HA:} HA:else { HA: $dbh->commit; HA:} btw, this subject is off-topic for this list. if you are still having problems, you probably should post your questions to a more appropriate list. perhaps perusing http://dbi.perl.org/ will yield a better forum for your questions. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]