I would also suggest that the first query go inside the else statement where you need it.
I don't see any point running code that you might not use before pointing the user back to the entry form. And you are welcome. Regards, Andrew Scott http://www.andyscott.id.au/ > -----Original Message----- > From: John Barrett [mailto:[email protected]] > Sent: Monday, 18 April 2011 9:39 PM > To: cf-newbie > Subject: Re: RE: RE: confused about cfabort > > > I got it`-` > thank so much for your help! > > my solution was: > <cfparam name="form.name" default=""> > <cfparam name="form.email" default=""> > <cfparam name="form.email_type" default="0"> <cfparam > name="form.organization" default=""> <cfparam name="form.activity" > default=""> > > <cfquery name="DupCheck" datasource="#REQUEST.dataSource#"> > SELECT * > FROM email_alerts > WHERE email_address = <cfqueryparam cfsqltype="cf_sql_varchar" > value="#Form.email_address#" /> </cfquery> > > > <!--- check to see if the user entered the correct e-mail twice ---> > > <cfif form.email_address neq form.email_address2> > The Emails did not match! > Please go back to the <a href="subscribe.cfm">subscribe form</a> and try > again. > > <cfelse> > > <p> > > <!--- If our query shows a email match than using recordCount we can tell the > user that his email address already exists in our database ---> > <cfif DupCheck.recordCount GT "0"> > Your email is already Listed in our Mailing List, <br /> Please go back to the <a > href="subscribe.cfm">subscribe form</a> and try again. > <!--- If our recordCount is not greater than "0" we continue on and process > the new email address ---> > > <cfelse> > > > <!--- Insert the new record ---> > <cfquery name="AddUser" datasource="#REQUEST.dataSource#"> > INSERT INTO email_alerts (name, email_address, email_type, > organization,activity, date) > VALUES ('#form.name#', > '#form.email_address#','#form.email_type#','#form.organization#','#form.a > ctivity#',#CreateODBCDateTime(Now())#) > </cfquery> > > <cfoutput> > Thank you #Name#,<br /> > Your email address [#email_address#] Has been entered into our mailing list. > You'll receive the next mailing! > </cfoutput> > > </cfif> > </cfif> > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~~~~~~~~| > Order the Adobe Coldfusion Anthology now! > http://www.amazon.com/Adobe-Coldfusion- > Anthology/dp/1430272155/?tag=houseoffusion > Archive: http://www.houseoffusion.com/groups/cf- > newbie/message.cfm/messageid:5275 > Subscription: http://www.houseoffusion.com/groups/cf- > newbie/subscribe.cfm > Unsubscribe: http://www.houseoffusion.com/groups/cf- > newbie/unsubscribe.cfm ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:5276 Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm
