I have several of these things,  displaying random tips or random quotes.
They all work flawlessly in SQLServer  with a query like:



Select top 1 Tipid, Tip, Source, SourceEMail from Tips Order By NEWID()



Each time the query is run, it produces a query containing a single record
taken at random from the table.   If you wanted to run it only once per day,
you could put it in a scheduled task, and put the result into an application
variable, or perhaps have a CACHEWITHIN parameter set in the CFQUERY tag.



Cheers

Mike Kear

Windsor, NSW, Australia

AFP Webworks

http://afpwebworks.com



  _____  

From: Tony Weeg [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 18 May 2004 12: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
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to