Copy link to clipboard
Copied
I have the following script that will fire off an email when a set number is achieved, ie: "minrequire" is set to 6. When six students have subscribed, an email is sent to the moderator. The problem is the email is being sent multiple times as more students subscribe, instead of only once at 6. Below is the script I am using. Why is this sending more than one emails?
<cfquery name="getNumber" datasource="#application.dsn#">
select CourseTitle, rid
from signups
where courseTitle = '#eventname#' and rid = '#rid#'
</cfquery>
<cfif getNumber.recordcount EQ #getCount.minRequire#>
Copy link to clipboard
Copied
You could debug it as follows, to see how often the if-condition is satisfied:
<cfif getNumber.recordcount EQ getCount.minRequire>
<p>Start debuggng <br>
<cfoutput>
getNumber.recordcount = #getNumber.recordcount# <br>
getCount.minRequire = #getCount.minRequire# <br>
</cfoutput>
End debugging</p>
<cfabort>