diff --git a/admin/committees.php b/admin/committees.php index b0aa40dc..297599cd 100644 --- a/admin/committees.php +++ b/admin/committees.php @@ -195,14 +195,19 @@ if($_POST['save']) else $emailupdate="email='".mysql_escape_string(stripslashes($_POST['email']))."', "; - $q=mysql_query("SELECT id FROM committees_members WHERE (email='".$_POST['emailprivate']."' OR emailprivate='".$_POST['emailprivate']."') AND id!='".$_POST['save']."'"); - if(mysql_num_rows($q)) - { - $emailprivateupdate=""; - echo notice(i18n("Cannot update private email address. That address already exists for a different committee member")); + $emailprivate = trim(mysql_escape_string(stripslashes($_POST['emailprivate']))); + if($emailprivate != '') { + $q=mysql_query("SELECT id FROM committees_members WHERE (email='$emailprivate' OR emailprivate='$emailprivate') AND id!='".$_POST['save']."'"); + if(mysql_num_rows($q)) + { + $emailprivateupdate=""; + echo notice(i18n("Cannot update private email address. That address already exists for a different committee member")); + } else { + $emailprivateupdate="emailprivate='$emailprivate', "; + } + } else { + $emailprivateupdate="emailprivate='$emailprivate', "; } - else - $emailprivateupdate="emailprivate='".mysql_escape_string(stripslashes($_POST['emailprivate']))."', "; mysql_query("UPDATE committees_members SET ". "name='".mysql_escape_string(stripslashes($_POST['name']))."', ".