<cfquery name="set_new" datasource="myDSN">
UPDATE tips
SET active_tip = 1
WHERE tip_id = #randRange(1-100) --if you have 100, or whatever
your total is
</cfquery>
since you probably will not have a 0 :)
also, your integer mismatch was most likely on the new() creating a uuid
there, and not an INT
which that column seems to be.
....tony
Tony Weeg
sr. web applications architect
navtrak, inc.
[EMAIL PROTECTED]
410.548.2337
www.navtrak.net
-----Original Message-----
From: Tony Weeg [mailto:[EMAIL PROTECTED]
Sent: Monday, May 17, 2004 10:47 PM
To: CF-Talk
Subject: RE: Daily Tip help...
<cfquery name="set_new" datasource="myDSN">
UPDATE tips
SET active_tip = 1
WHERE tip_id = newID()
</cfquery>
that's going to create a uuid in sql server
I would do this....
<cfquery name="set_new" datasource="myDSN">
UPDATE tips
SET active_tip = 1
WHERE tip_id = #randRange(0-100) --if you have 100, or whatever
your total is </cfquery>
some cf anals will set that random number before the query...but either
way will work.
....tony
Tony Weeg
sr. web applications architect
navtrak, inc.
[EMAIL PROTECTED]
410.548.2337
www.navtrak.net
-----Original Message-----
From: Bailey, Neal [mailto:[EMAIL PROTECTED]
Sent: Monday, May 17, 2004 10:41 PM
To: CF-Talk
Subject: RE: Daily Tip help...
Well this is kind of what I am trying to do...
I want to automate it though so that all I have to do is keep adding
tips and the system will just continue to rotate through them either
randomly or in order either is ok with me. Over time I will be adding
more tips so this database could have hundreds as time goes on.
The code below is what I am trying to do but I keep getting an Integer
mismatch error.
All I want is a simple Tip of the day thing just like Ben Forta has on
his site or Like Sitepoint. Thanks for the help...
<!--- Sets Scheduler in cfadmin to run this once a day --->
<!--- reset all tips to inactive --->
<cfquery name="clear_active" datasource="myDSN">
UPDATE tips
SET active_tip = 0
</cfquery>
<cfquery name="set_new" datasource="myDSN">
UPDATE tips
SET active_tip = 1
WHERE tip_id = newID()
</cfquery>
---------------------------------------------------------
<!--- Dipslay Tip on page --->
<cfquery name="get_tip" datasource="myDSN">
SELECT daily_tip
FROM tips
WHERE active_tip = 1
</cfquery>
Neal Bailey
Internet Marketing Manager
E-mail: <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
_____
From: Greg Luce [mailto:[EMAIL PROTECTED]
Sent: Monday, May 17, 2004 8:18 PM
To: CF-Talk
Subject: RE: Daily Tip help...
How about flag the tip record with a bit field called 'live'. Then you
can see the tip that's "live", and then take the next tip in whatever
order you have them.
Greg
-----Original Message-----
From: Tony Weeg [mailto:[EMAIL PROTECTED]
Sent: Monday, May 17, 2004 10:11 PM
To: CF-Talk
Subject: RE: Daily Tip help...
why not put them in a database, with a sort order, and whatever day of
the month it is, show that based on the sort order numbered from 1-28 or
something like that? or just do it randomly. where each page refresh
would show a new one?
....tony
Tony Weeg
sr. web applications architect
navtrak, inc.
[EMAIL PROTECTED]
410.548.2337
www.navtrak.net
-----Original Message-----
From: Bailey, Neal [mailto:[EMAIL PROTECTED]
Sent: Monday, May 17, 2004 9:51 PM
To: CF-Talk
Subject: Daily Tip help...
Hello All...
I am having an issue with trying to build a rotating daily tips script.
All I want to do is have a database full of tips and everyday have a new
tip display on the front page. I thought it was easy but for some reason
I cannot get it to work. I have about 40 tips so all it needs to do is
select the next record everyday. Can someone point me in the right
direction... I have looked all over the net for examples but oddly
enough there are not any that do such a simple thing, at least that I
could find.
Thanks for any help on this I'm sure its simple, but for some reason I
cant figure it out.
- Neal
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

