close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Check for duplicate email/username

Thread began 9/24/2009 6:27 am by georgina_barrett_187762 | Last modified 11/04/2010 11:45 am by georgina_barrett_187762 | 12232 views | 19 replies


Check for duplicate email/username

I am really struggling to get this to work. I want to validate the registration form to check if the username(email) is already in the database. I constructed the form via dataassist. I have read in earlier posts that say you can create a recordset that selects the username when it matches the form field username and then use COUNT to give a number. Then use the WA server validation to match that the COUNT is 0 to proceed.

The problem I think I am having is that the recordset it being produced when the page loads (so the username field is blank) and then when the form validates it on button press it validated against nothing.

However the validation is failing as it is going to my redirect on fail page - whether or not there is a duplicate email in the database.

The code for my recordset is;
$colname_username = "-1";
if (isset($_POST['Username'])) {
$colname_username = (get_magic_quotes_gpc()) ? $_POST['Username'] : addslashes($_POST['Username']);
mysql_select_db($database_mainconnect, $mainconnect);
$query_username = sprintf("SELECT COUNT(Customer.Username) FROM Customer WHERE Customer.Username=%s", GetSQLValueString($colname_username, "text"));
$username = mysql_query($query_username, $mainconnect) or die(mysql_error());
$row_username = mysql_fetch_assoc($username);
$totalRows_username = mysql_num_rows($username);?>

The code for the validation is;
if (isset($_POST["Register_x"])) {
$WAFV_Redirect = "Customer_LogIn.php?register=1";
$_SESSION['WAVT_CustomerRegistration_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateLE($row_username['COUNT(Customer.Username)'] . "",0 . "",true,4);

if ($WAFV_Errors != "") {

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...