This content has been marked as final. Show 4 replies
<cfif NOT IsDefined ('email')>
<cfset email = "">
<cfset email= #URL.email#>
<cfquery name="email_search" datasource="#Request.MainDSN#">
SELECT email FROM database WHERE email='#FORM.email#'
<cfif email_search.RecordCount GTE 1>
Then in your body have:
<cfif email NEQ "">Sorry, that email address already exists, please try
Thats how I did it with my newsletter signup to negate duplicates
insert into your_table
(surname, firstname, emailaddress)
select distinct '#form.surname#', '#form.firstname#', '#form.emailaddress#'
where not exists
where surname = '#form.surname#'
and firstname = '#form.firstname#' )
By the way, how are you going to cope with two people having the same name?
Does it matter if they have the same name and not the same email address?
Names are not unique in the world.
Why would this be a requirement?
Many thanks good point
ok there will always be a email address now so what would the code be for
if Form.Surname = Users.Surname and Form.FirstName = Users.FirstName and Form.EmailAddress = User.EmailAddress
then send alert box saying "already a user"
if none of the above enter new record