On Fri, 17 Jan 2003 at 17:10, Hughes, Andrew opined: [snip] HA:The goal is that before I submit a form submission to the database, I want HA:to make sure that someone with the same email address has not already HA:submitted it. If the count(*) brings up anything greater than 0 then the HA:users has already submitted an entry and receives the "Duplicate Entry" [snip]
why don't you put a unique index on the email field? that will prevent duplicate records and save you a lot of overhead using perl to check for uniqueness. then, when you go to insert a new record, wrap it in an eval {}. if $@ contains something after the insert attempt, it's probably because the unique index constraint was violated. for example: my $sth = $dbh->prepare('insert into (foo) values(?)'); eval { $sth->execute('[EMAIL PROTECTED]'); }; if ($@) { warn "error - probably a violation of the unique constraint"; # return something to the user } else { $dbh->commit; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]