Ok, the following script works great for checking if an email address already resided in my database for $desemail. But, how can i make this check two fields on my form against the same column in my database?
Example: One field on my form is $desemail - (Email #1)
Another field is $altemail - (Email #2)
I need this form to check both user inputs against the one column this script is checking at this time listed below...Any help is very, very. very, appreciated....
// *** Redirect if element exists on insert
$FX_flag = "MM_insert";
$FX_found = false;
if (isset($HTTP_POST_VARS[$FX_flag])) {
$FX_dupKeyRedirect = "/Email/Unsubconfirm.php";
$FX_dupKeyValue = $HTTP_POST_VARS["desemail"];
$FX_dupKeySQL = "SELECT `Assigned Email` FROM emailacc WHERE `Assigned Email` = '" . $FX_dupKeyValue . "'";
mysql_select_db($database_gspot, $gspot);
$FX_rsKey=mysql_query($FX_dupKeySQL, $gspot) or die(mysql_error());
if(mysql_num_rows($FX_rsKey) > 0) {
// this value was found - can not execute action
$FX_found = true;
$FX_dupValue = "desemail (" . $FX_dupKeyValue . ") ";
}
if($FX_found) {
$FX_dupValue .= "already exists!";
$FX_qsChar = "?";
if ($FX_dupKeyRedirect == "") $FX_dupKeyRedirect = substr($HTTP_SERVER_VARS["PHP_SELF"], strrpos($HTTP_SERVER_VARS["PHP_SELF"], "/")+1);
if (strpos($FX_dupKeyRedirect, "?")) $FX_qsChar = "&";
$FX_dupKeyRedirect = $FX_dupKeyRedirect . $FX_qsChar . "FX_ReqValue=" . urlencode($FX_dupValue);
header ("Location: " . $FX_dupKeyRedirect);
exit;
}
mysql_free_result($FX_rsKey);
}