Not this one...

I have a custom made "mailout" - it takes unsent records from the DB,
emails them to those who are interested (denoted by "instant = 1") and
updates them as "sent."  This is all done in a cfloop.  What I proposed
to do was allow subscribers to limit the amount of emails sent to them
each hour (1-20, at their choosing).  So in the member's table I added 2
columns; maxhour and hourcounter - maxhour holding their preference, and
hourcounter incrementing by one each email that was sent to them and
then resetted on the hour by the scheduler back to 0.

But my script is ignoring the limits set.  I tried the following query
(ToSend):

SELECT * FROM Feeds,cemails
WHERE Feeds.Sent = 0
AND pin = 0
AND instant = 1
AND hourcounter < maxhour
AND pemail = '[EMAIL PROTECTED]'

(I restricted this example to just my Test email addy...)  Then in the
cfloop:

<cfloop query="ToSend">

<Cfif (hourcounter GTE maxhour)>

<Cfoutput>#pemail#</CFOUTPUT> exceeded hourly limit<br>

<cfelse>
<Cfoutput>#pemail#</CFOUTPUT> not exceeced hourly limit, send mail<Br>

<cfmail here>

<cfquery name="updSent">
UPDATE feeds
SET sent = 1
WHERE FID = #FID#
</cfquery>

<cfquery name="updhours">
UPDATE cemails
SET hourcounter = hourcounter + 1
WHERE pemail = '#pemail#'
</cfquery>

</cfif>
</cfloop>


Now for whatever reason, the <Cfif (hourcounter GTE maxhour)> check
isn't working, and limitation isn't being enforced.  Can anyone see
where I'm going wrong?

Cheers

Will

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to