Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

posting data, and avoiding duplicate posts... 1

Status
Not open for further replies.

WaZiR006

Technical User
Oct 20, 2000
11
0
0
CA
Hi everyone,

just a quick question, when posting data onto a SQL database, i want it to check for the email and if it exists it wont post and shows a friendly message. I've tried by making the email as primary key but i don't want my users to see that cf's nasty error page! How about defining an error page for CF ?? could i use a CFIF statement in the page with my query in it ? if so can someone post an example ?? any solution will be appriciated! :)


Take Care and Thanks!
 
<cfquery name=&quot;checkEmail&quot; datasource=&quot;#DSN#&quot;>
Select *
From Table
Where email like '#form.email#'
</cfquery>

<cfif checkemail.recordcount GT 0>
There is already a record in the DB with the same email address. Go back and type in a different email.
<cfelse>
.... Insert data into your database here.
</cfif>

Hope this is what you were asking for. If not, let me know.
[sig]<p>Chad Elley<br><a href=mailto:celley@gobcg.com>celley@gobcg.com</a><br>[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top