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.
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
have
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 isnt
It was pulling in the wrong ADID when showing an image... I had to put
#GetAds.ADID# in the Where instead of just #ADID#.
UPDATE dbo.banner_left
SET views = #add#
WHERE ADID = #GetAds.ADID#
It seems to be working now. Thank you so much for all your help.
~
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
Tried Isaac's and it doesnt count any of the views.
SELECT *
from dbo.banner_left
SELECT *
FROM getCachedAds
WHERE ADID = #ADID#
ORDER BY ADID
UPDATE dbo.banner_left
SET views = #add#
WHERE ADID = #ADID#
~~
I tried Mikes code:
SELECT top 1 *
FROM dbo.banner_left
ORDER BY newID()
works great for the random but it screws up the views.
UPDATE dbo.banner_left
SET views = #add#
WHERE ADID = #ADID#
It either doesnt count it or it will pull the views from another record puts it
in that
> 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
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
http://afpwebwork
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
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 ex
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
SELECT top 1 *
FROM dbo.banner_left
WHERE lastdisplay <'whatever'
ORDER BY newID()
That way you're suing SQLServer's inbuilt randomiser, doing the whole
Here's my suggested modification
SELECT * dbo.banner_left
SELECT *
FROM getCachedAds
WHERE ADID = #ADID#
ORDER BY ADID
Not sure why there even was an order by in that query originally, since
it will only return one record anyway. Probably won't affect performance,
but you m
> > 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
> > spe
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.
SELECT top 1 *
FROM dbo.banner_left
ORDER BY newID()
That will select a random record from the table banner_left
Cheers
Mike Kear
Windsor, N
> 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
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 th
17 matches
Mail list logo