Well, ad_id should always equal ad_id, so every item is getting updated,
every time through the loop.

Perhaps it should be WHERE ad_id = #getEntries.ad_id#.

Why not just do something like

<cfquery>
UDPATE ads SET online_approval = '2' WHERE AdWasPlacedOnThisDate <
#createODBCDateTime(now())#
</cfquery>

-----Original Message-----
From: Bosky, Dave [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 21, 2000 1:58 PM
To: CF-Talk
Subject: 


I'm trying to compare the current date to an expire-on date and mark the ad 
as expired if the datecompare function returns a value gte 0. Everything
seems 
ok except that it marks every ad as expired regardless of returned value.

<CFLOOP QUERY="GetEntries">
<CFSET AdWasPlacedOnThisDate = posted_on>
<CFSET expiration_date = #dateformat(DateAdd('D', 30,
AdWasPlacedOnThisDate), "DD-MMM-YY")#>
<CFSET comparison = DateCompare(CurrentDate,expiration_date>
<CFIF comparison GTE 0>
<CFQUERY datasource="xxx" DBTYPE="ODBC">
        UPDATE Ads
        SET online_approval = '2'
        WHERE ad_id = ad_id
</CFQUERY>
</CFIF>
</CFLOOP>

Thanks

Dave Bosky   
HTC Web Application Developer   
843.369.8613              
[EMAIL PROTECTED]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to