Thanks Howie that worked. I just thought I could do it in a cfif tag.
  -----Original Message-----
  From: Howie Hamlin [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, October 06, 2004 4:00 PM
  To: CF-Talk
  Subject: Re: Check emails not working

  Try:

  <cfquery name="check_email" datasource="#mydbname#">

  SELECT email_address
  FROM newsletter
  where email_address='#form.email_address#'
  </cfquery>

  <cfif check_email.recordcount neq 0>
  Your email address is already in our system.

  <cfelse>
  ...

  HTH,

  --
  Howie Hamlin - inFusion Project Manager
  On-Line Data Solutions, Inc. - www.CoolFusion.com
  inFusion Mail Server (iMS) - The Award-winning, Intelligent Mail Server
  PrismAV - Virus scanning for ColdFusion applications
  >>> Find out how iMS Stacks up to the competition:
http://www.coolfusion.com/imssecomparison.cfm

    ----- Original Message -----
    From: Phillip Perry
    To: CF-Talk
    Sent: Wednesday, October 06, 2004 3:52 PM
    Subject: Check emails not working

    The situation I have to deal with now is this...

    A form gets filled out with just an email address. When the submit
button is
    clicked the action page for putting the address in the DB is brought up.
    This page is supposed to check to see if the same email address is
already
    in the system, and if it is to throw an error to the user. But
unfortunately
    for some reason this isn't happening.

    What I get now is either all emails are blocked or no emails are
blocked. I
    have included the code below. This particular version of code registers
    anyone to the newsletter whether or not they are already signed up.

    Any help is appreciated!

    <cfquery name="check_email" datasource="#mydbname#">

    SELECT newsletter_id, email_address
    FROM newsletter

    </cfquery>

    <cfif 'email_address' EQ <!--- I have tried IS also --->
    #form.email_address#>

    Your email address is already in our system.

    <cfelse>

    <cfquery datasource="#mydbname#" name="newsletter">

    INSERT INTO newsletter (email_address)
    VALUES('#form.email_address#')

    </cfquery>

    You are now registered to The Newsletter.

    </cfif>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to