close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Avoiding duplicates

Thread began 8/24/2010 7:29 am by johnffrench314542 | Last modified 12/09/2010 10:21 am by Jason Byrnes | 897 views | 5 replies |

johnffrench314542

Avoiding duplicates

I have UE ver 4 and I am using it to populate a MySQL database from a web form that collects email addresses and names so I can send out newsletters. As implemented out of the box it allows duplicate email addresses, how can I alter it to stop it doing so and send a message to the person filling in the online form that that email address is already in the database?

Sign in to reply to this post

Jason ByrnesWebAssist

so you have a form that allows people to enter an email address to sign up for the news letter?


You would need to create a recordset on the page to lookup the email address that is entered in the form, then use the server validations portion of CSS Form builder to validatie that the recordset is empty (email has not already been added).

use number validation.

For the server variable enter "$totalRows_<recordsetName>" where <recordsetName> is the name of the recordset.

when setting up number validation, set the minimum number to -1, and the max to 0

Sign in to reply to this post

johnffrench314542

Thanks for the prompt reply.

I did not build the form with CSS form builder, just created it with Dreamweaver in the normal way. As it is an html page I cannot create a recordset on it.

The form posts to a file called regform.php which your programme Universal Email created. What I want to do (and I am sure most of your customers would want to do) is modify the code on this form so that it checks the database for a duplicate email address before dumping it to the database, and if it finds a duplicate does not do the dump and redirects to a page with a message.

Many thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

The instructions from my previous reply still hold, you will just need to create the recordset and apply server validations on the php page.

Sign in to reply to this post

robin.harrison368334

Error with recordset?

Hello,

I've tried to follow this as well to have validation for no duplicates of the email field with no success.

I keep getting the error:

Fatal error: Call to undefined function getsqlvaluestring() in /home/content/74/6081974/html/reports/Templates/Users_Registration.php on line 13


Not sure why this happening.

Trying to check the form field "userName" on the page doesn't already exist in the database under the field "userName".

I've attached the php code.

Any help is greatly appreciated.

Attached Files
Users_Registration.zip
Sign in to reply to this post

Jason ByrnesWebAssist

the code at line 53 - 84 needs to be moved to line 1.

php:
<?php

if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}
?>
Sign in to reply to this post

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

Content

rating

Layout

rating

Ease of use

rating

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...