I would have thought the counting of views wouldnt have anything to do with how the banner is selected. They are two different db transactions.
Are you sure that .val(GetADs.views) is giving you a numeric value? Are you sure that incrementvalue(val(GetADs.views)) is giving you a value 1 greater than the number of views? If you are getting those values right, your query should work to update the views number in the table. I would just be certain that the elements are giving you the values you think they should be . I would be checking with CFDUMPs to make sure that val(GetADs.views) and incrementvalue(val(GetADs.views)) are showing the results you are expecting. I dont know how your GetAds query would be drawing data from the wrong record. I notice that your GetADs has datasource="#Green#" and the other query has datasource="Brooke". Could that be a source of the error? Do you have two different datasources? HTH Cheers Mike Kear Windsor, NSW, Australia Adobe Certified Advanced ColdFusion Developer AFP Webworks http://afpwebworks.com ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month On Tue, Dec 9, 2008 at 9:06 AM, Sin Tec <[EMAIL PROTECTED]> wrote: > I tried Mikes code: > <CFQUERY DATASOURCE="#Green#" NAME="GetADs"> > SELECT top 1 * > FROM dbo.banner_left > ORDER BY newID() > </CFQUERY> > > works great for the random but it screws up the views. > > <CFSET add = incrementvalue(val(GetADs.views))> > <CFQUERY datasource="Brooke" name="AddView"> > UPDATE dbo.banner_left > SET views = #add# > WHERE ADID = #ADID# > </CFQUERY> > > It either doesnt count it or it will pull the views from another record puts > it in that record. :( > > I will try working with Isaacs code but im not to fond of the delay in the > delete. > > Thank you guys for all your help > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316450 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4