ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 16th, 2005, 07:16 AM
cootjealweer1 cootjealweer1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 28 cootjealweer1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 38 m 59 sec
Reputation Power: 0
How to adjust this code to No duplicate e-mail

Hi all,

I've got a query that result in sending e-mail notifications to the persons based on the where statement.

It works perfect. The only problem is that the table (gebruikers) holds all the reply's on a specific article, so if a user has replied 6 times to the same article and the selectdatum is set to 'Y' , i get 6 e-mails.

So my question is how can i adjust the code and send only one match instead of 6...

<cfquery name="emailadressen" datasource="spirilog">
SELECT email
FROM gebruikers
WHERE selectdatum = 'Y' and onderwerpid = '#url.id#'
</cfquery>

<cfmail query="emailadressen"
from="info@aquarius.eu"
to="#emailadressen.email#"
bcc=""
subject="Nieuwe reactie op Aquarius.eu"
>

</cfmail>

I hope this is understandable explained.

Anyone knows?


Reply With Quote
  #2  
Old September 16th, 2005, 08:23 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
<cfquery name="emailadressen" datasource="spirilog">
SELECT DISTINCT email
FROM gebruikers
WHERE selectdatum = 'Y' and onderwerpid = '#url.id#'
</cfquery>

However, a deeper question is why are there duplicate email addresses in the database in the first place. If email should be unique, you should place a unique constraint on that column so that duplicates cannot be inserted.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old September 16th, 2005, 09:13 AM
cootjealweer1 cootjealweer1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 28 cootjealweer1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 38 m 59 sec
Reputation Power: 0
That's perfect! Thanks

Well, there are duplicate e-mail adresses in that table because it's a table that contains reply's to articles, so a user can reply as many times as he/she wishes and every time a emailadres is entered.

Maybe there's another or better contruction, but this is the only way i can think of...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > How to adjust this code to No duplicate e-mail


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT