Thanks Tony,


I have it working good now... here is The Tip Of The Day code incase anyone
is wants to do the same.


I set up the scheduler to run this once a day. I may set it every hour.


-----------------Code------------------
<!--- reset all tips to inactive --->
<cfquery name="clear_active" datasource="myDSN">
     UPDATE Tips
     SET active = 0
</cfquery>


<!--- Lets Count the Records --->
<cfquery name="CountRecords" datasource="myDSN">
     SELECT COUNT(Tips.Tip_ID) AS maxrecords
     FROM Tips
</cfquery>


<!--- Set the random record --->
<cfset RandomCount = randRange(1, #CountRecords.maxrecords#)>


<!--- Now set the new tip as active --->
<cfquery name="set_new" datasource="myDSN">
     UPDATE Tips
     SET active = 1
     WHERE tip_id = #RandomCount#
</cfquery>
------------------END---------------------

Then all I do is output the active tip.


Thanks for the help....


Neal Bailey
Internet Marketing Manager
E-mail:  <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
  _____  

From: Tony Weeg [mailto:[EMAIL PROTECTED]
Sent: Monday, May 17, 2004 8:52 PM
To: CF-Talk
Subject: RE: Daily Tip help...


or, actually...

<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
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to