Yer wasting a lot of processing power in coldfusion unnecessarily.  You
should build a where clause that replicates the conditions you are searchinf
for in your CFIF, that way you just loop over the result set and send the
email to every single record.  SQL Will handle that much faster than Cold
Fusion will.

Jordon


-----Original Message-----
From: Chris Giminez [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 28, 2000 1:40 PM
To: [EMAIL PROTECTED]
Subject: looping through a mailing list


This is for a real estate web site where the realtor will add their own
property. When new property
is added, I want it to check a data table of subscribers who are interested
in a property fitting
certain criteria, such as price, number of bedrooms, bathrooms, etc.

I thought I had this figured out, but am not getting the desired results.

Here's my code:
******************
<!--- Get the list of subscribers who wich to be notified. --->
<CFQUERY NAME="notify_list" DATASOURCE="kane">
SELECT      *
FROM         notify
ORDER BY  date_subscribed
</CFQUERY>

<!--- Loop through the subscribers --->
<cfloop QUERY="notify_list">

<!--- Check the desires of the subscriber against the actual values of the
property. --->
<cfif
form.bed gte notify_list.des_bed
AND
form.bath gte notify_list.des_bed
AND
form.garage gte notify_list.des_garage
AND
form.price gte notify_list.gt_price
AND
form.price lte notify_list.lt_price
AND
form.sq_ft gte notify_list.des_sq_ft
AND
notify_list.des_city CONTAINS form.city
AND
form.display eq 1
AND
form.status eq "for sale"
>
<!--- Send email if the cfif evaluates true <cfmail block will go here when
it's working right. --->
Send email to <cfoutput query="notify_list">#notify_list.first_name#
#notify_list.last_name#</cfoutput><br>
<cfelse>

<!--- Don't send email if cfif evaluates to false. cfelse is only here for
testing now. --->


Don't send email <cfoutput query="notify_list">#notify_list.first_name#
#notify_list.last_name#</cfoutput><br>

</cfif>

</cfloop>
**********************

I currently have just 3 subscrbers in the notify table for testing and the
above code gives me this
result.

*****************
Send email to joe testerTest PersonChris Giminez
Don't send email joe testerTest PersonChris Giminez
Don't send email joe testerTest PersonChris Giminez
*****************
It's somehow evaluating to true and false for each person.

I know I'm close to getting this. If someone could enlighten me I would be
most grateful.

Thanks!

Chris Giminez
Owner - Cyber Scriber Web Site Design
831-728-4469
ICQ# 2628000





----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.


------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to