I'm no PHP whiz, but I get by ok. I have this one chunk of php generated by Dreamweaver (no comments please) and the page (containing a table insert function) works fine, but as soon as I add this to check and see if the 'Email' field already exists in the table causes the page to load blank - the typical unexplained code error display. This has worked fine in the past and I've not changed this code at all from when it was generated. I be curious if anyone can see why it might break the page:
// *** Redirect if username exists
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
$MM_dupKeyRedirect="duplicate.php";
$loginUsername = $_POST['Email'];
$LoginRS__query = sprintf("SELECT Email FROM Registrations WHERE Email=%s", GetSQLValueString($loginUsername, "text"));
mysql_select_db($database_midwinter, $midwinter);
$LoginRS=mysql_query($LoginRS__query, $midwinter) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
//if there is a row in the database, the username was found - can not add the requested username
if($loginFoundUser){
$MM_qsChar = "?";
//append the username to the redirect page
if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
$MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
header ("Location: $MM_dupKeyRedirect");
exit;
}
}