To repeat the question "once I get the error condition it doesn't seem to get reset. My code is as follows: $qry = "INSERT INTO hamlog (QSLnumber,QSLdate,QSLtime,Cardsent,Cardrcvd,CallSign,Band,RSsent,RSrcvd,Comments) VALUES ('"; $qry .= $QSLnumber."','".$QSLdate."','".$QSLtime."','".$QSLsent."','".$QSLrcvd."','".$callSign."','".$band."','".$rsIn."','".$rsOut."','".$comment."')"; if($QSLnumber!=0){ if(strlen(trim($callSign))>0){ mysql_query($qry);# or die ("Failure in Upload of ".$fName." with qry - ".$qry." from file ".$fName." ".mysql_error().", error number ".mysql_errno()); if(mysql_errno()==1062){ // The test for a duplicate caused by using unique in db creation Show("dup of ".$QSLnumber." in file ".$fName); } else if (mysql_error()!=0){ die ("Failure in Upload of ".$fName." with qry - ".$qry." from file ".$fName." ".mysql_error()); } }