Hello, I'm having an issue with my registration code. for some reason, everything functions properly up until it gets to the actual data insertion portion of the php. It bumps me over to my error code "$errormsg = "An error has occurred. Your account was not created.";"
Can somebody tell me why this is? I've looked it over for a few hours now.
$query1 = mysql_query("SELECT * FROM members415 WHERE username='$getuser'");
$numrows = mysql_num_rows($query1);
if ($numrows == 1){
$site = 'http://www.edit.com';
$headers = 'From: TC Admin <admin@edit.com>';
$subject = 'edit: Activate your account';
$message = 'Thanks for registering your edit account. In order to use your account, you must first activate it with the following details; URL: (http://www.edit.com/activate.php) Code: ('.$code.') Click the following link to activate your account. '.$site.'/activate.php?user='.$getuser.'&code='.$code.'';
if (mail($getemail, $subject, $message, $headers)){
$errormsg = "<font color='blue'>You have been registered. You must activate your account with the activation link sent to <b>$getemail</b></font>";
echo "$backcontent$errormsg$content.";
$getuser = '';
$getemail = '';
$_POST['submitbtn'] = '';
mysql_close();
}
else
$errormsg = "An error has occurred. Your activation email was not sent.";
echo "$backcontent <font color'red'>$errormsg</font> $content";
mysql_close();
}
else
$errormsg = "An error has occurred. Your account was not created.";
echo "$backcontent <font color='red'>$errormsg</font> $content";
mysql_close();
}
else
$errormsg = "There is already a user with that email address.";
echo "$backcontent <font color='red'>$errormsg</font> $content";
mysql_close();
}
else
$errormsg = "There is already a user with that username.";
echo "$backcontent <font color='red'>$errormsg</font> $content";
mysql_close();
}
else
$errormsg = "You must enter a valid email address to register.";
echo "$backcontent <font color='red'>$errormsg</font> $content";
}
else
$errormsg = "Your passwords did not match.";
echo "$backcontent <font color='red'>$errormsg</font> $content";
}
else
$errormsg = "You must verify your password to register.";
echo "$backcontent <font color='red'>$errormsg</font> $content";
}
else
$errormsg = "You must enter a password to register.";
echo "$backcontent <font color='red'>$errormsg</font> $content";
}
else
$errormsg = "You must enter your email to register.";
echo "$backcontent <font color='red'>$errormsg</font> $content";
}
else
$errormsg = "You must enter your username to register.";
echo "$backcontent <font color='red'>$errormsg</font> $content";
}
else
well, based on your code, I won't be able to know if there's an error on your "INSERT INTO tc_members415...". maybe you could try adding " or die(mysql_error())" so you would know if there's an error and what error you are having on that query. Your code for that insert will be :
I've been looking at the code all night looking over what was correct... the issue was in the database where a unique key was set for a column that also had a default setting of "None" and all new registrants have to pass through that "None" value at first, so I disabled the unique key and will just later add a filter to replace that duty.
Thanks!!! I've learned a lot from this...
"Always make new mistakes." I won't be repeating this one.
I thought so it was in the database. That's why you have to include always the mysql_error() to know what exactly is the error in database. Well, that will be charged to your experience as a developer. =)
Bookmarks