Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Using recordcount to send an email when dynamic number is hit

Guest
Feb 15, 2014 Feb 15, 2014

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#>

330
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 16, 2014 Feb 16, 2014
LATEST

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>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources