Re: Advertisment Content Management - problem with random image

2009-01-06 Thread Sin Tec
New Problem. A have advertisements but want to assign them to different pages. I guess im just new to it all and lack the thinking. Im trying to set it all up to where you can put it in three locations if you want. Im using ORs but the ORs stop the query once it finds something. So if I

Re: Advertisment Content Management - problem with random image

2009-01-06 Thread Sin Tec
Ok I think I fixed it. I forgot to ORDER BY newID() Thank you. New Problem. A have advertisements but want to assign them to different pages. I guess im just new to it all and lack the thinking. Im trying to set it all up to where you can put it in three locations if you want. Im

Re: Advertisment Content Management - problem with random image

2008-12-09 Thread Sin Tec
It was pulling in the wrong ADID when showing an image... I had to put #GetAds.ADID# in the Where instead of just #ADID#. !--- incrementvalue Adds one to an integer, so it adds one to views--- CFSET add = incrementvalue(val(GetADs.views)) CFQUERY datasource=Brooke name=AddView UPDATE

Re: Advertisment Content Management - problem with random image

2008-12-09 Thread Mike Kear
Ah yes that will be because there is another variable somewhere in the request with the name ADID and it was using that instead of the one coming from your query. Thats why you should always scope your variables, unless there is a specific reason not to. If you scope them, the function

Re: Advertisment Content Management - problem with random image

2008-12-08 Thread Sin Tec
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

Re: Advertisment Content Management - problem with random image

2008-12-08 Thread Sin Tec
Tried Isaac's and it doesnt count any of the views. CFQUERY DATASOURCE=#Green# NAME=getCachedAds cachedwithin=#CreateTimeSpan(1,0,0,0)# SELECT * from dbo.banner_left /CFQUERY !--- RandRange is Random integer between first number and second(1st,2nd) --- CFSET ADID =

Re: Advertisment Content Management - problem with random image

2008-12-08 Thread Mike Kear
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

Re: Advertisment Content Management - problem with random image

2008-12-04 Thread Mike Kear
Yea you're right Ike. Story of my life - I relax for once and make a smart-alec comment and it whips around and bites me. But in my own defence, mine takes less typing! LOL . Cheers Mike Kear Windsor, NSW, Australia Adobe Certified Advanced ColdFusion Developer AFP Webworks

Re: Advertisment Content Management - problem with random image

2008-12-04 Thread s. isaac dealey
Yea you're right Ike. Story of my life - I relax for once and make a smart-alec comment and it whips around and bites me. Yer lucky you added the my dad can beat up your dad comment at the end, otherwise I might not have picked up on the fact that you were jokin' around. :) But in my own

Advertisment Content Management - problem with random image

2008-12-03 Thread Sin Tec
I am using a varent from sparty2809 on http://tutorial323.easycfm.com/ It works great but was created for ACCESS and uses an autonumber datatype. Its great when you just keep adding advertisments but when you delete one there is now a gap in the +one ADID (int - identity specification). When

Re: Advertisment Content Management - problem with random image

2008-12-03 Thread Will Tomlinson
I am using a varent from sparty2809 on http://tutorial323.easycfm.com/ It works great but was created for ACCESS and uses an autonumber datatype. Its great when you just keep adding advertisments but when you delete one there is now a gap in the +one ADID (int - identity specification).

Re: Advertisment Content Management - problem with random image

2008-12-03 Thread Mike Kear
Why not select out of the database using a random selection of the indexes that are there? Then you never have to worry about gaps. They dont matter. CFQUERY DATASOURCE=#Green# NAME=GetADs maxrows=1 SELECT top 1 * FROM dbo.banner_left ORDER BY newID() /CFQUERY That will select a random

Re: Advertisment Content Management - problem with random image

2008-12-03 Thread s. isaac dealey
I am using a varent from sparty2809 on http://tutorial323.easycfm.com/ It works great but was created for ACCESS and uses an autonumber datatype. Its great when you just keep adding advertisments but when you delete one there is now a gap in the +one ADID (int - identity

Re: Advertisment Content Management - problem with random image

2008-12-03 Thread s. isaac dealey
Here's my suggested modification !--- Gets Maximum number of ads--- CFQUERY DATASOURCE=#Green# NAME=getCachedAds cachedwithin=#CreateTimeSpan(1,0,0,0)# SELECT * dbo.banner_left /CFQUERY !--- RandRange is Random integer between first number and second(1st,2nd) --- CFSET ADID =

Re: Advertisment Content Management - problem with random image

2008-12-03 Thread Mike Kear
slight correction - i had a redundancy - you dont need maxrows=1 as well as SELECT top 1 so the query would be better written as CFQUERY DATASOURCE=#Green# NAME=GetADs SELECT top 1 * FROM dbo.banner_left ! if you want to add some restrictions like for example only select from the ones

Re: Advertisment Content Management - problem with random image

2008-12-03 Thread Mike Kear
Ike, your query will still attempt to select records that have been deleted The original problem was that the keys werent sequential if some records have been deleted. That's going to happen as ads are removed. Using the technique I use, it selects a random record from the records that

Re: Advertisment Content Management - problem with random image

2008-12-03 Thread s. isaac dealey
Mike Kear said: Ike, your query will still attempt to select records that have been deleted The original problem was that the keys werent sequential if some records have been deleted. That's going to happen as ads are removed. Using the technique I use, it selects a random record