Check if Email Exists on update - is there a better way
Hello,
I am using server side validation from the form toolkit on a DataAssist update form.
I have a recordset which is returning a value of 1 in $totalRows_BLAH if the email address exists already, however, on update if the value is not changed it returns a value of 1 because the unchanged email is already in the database. I have gotten around this in the past like this:
if ($_POST['users_email'] == $row_WADAusers['users_email']) {
$WAFV_Errors .= WAValidateNM($totalRows_chkEmailUnique . "",0,1,"",",.",true,1);
} else {
$WAFV_Errors .= WAValidateNM($totalRows_chkEmailUnique . "",-1,0,"",",.",true,1);
}
The issue with this is that the statement gets overwritten if I update or add another server validation. I have been keeping this code safe close by with a commented out php section so that I can repaste it when I need to.
My question is - is there a better way? :)