I do this and then I remove the image record after it is used. Then once all the images have been used up, I re-query the database for a new set. Two benefits, I get any new images added since the first set was created as well as all images are seen once before any are seen twice.
-------------- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA "C code. C code run. Run code run. Please!" - Cynthia Dunning ....-----Original Message----- ....From: Raymond Camden [mailto:[EMAIL PROTECTED] ....Sent: Wednesday, March 02, 2005 1:43 PM ....To: CF-Talk ....Subject: Re: use RandRange for rotating banner image? .... ....While I think some DBs allow you to pick a random record, why not go ....an easier route. Query to get all the IDs and imagenames. Cache the ....query. Then just select a random record. You won't be rerunning the ....query each time since it will be cached. .... .... ....On Wed, 02 Mar 2005 16:34:40 -0400, Will The Game <[EMAIL PROTECTED]> ....wrote: ....> Question: Why couldn't I use RandRange in a query to rotate a banner ....image? I usually use JS buit it looks like a bunch of crap code. *This* ....would be simple. ....> ....> I have a tblbannerimages with ID# as PK, imagename is like image1.jpg ....or whatever. ....> ....> ID's would be 1, 2, 3, 4, 5 let's say ....> ....> Now I run a query to retrieve one to output it to the banner everytime ....the page loads. ....> ....> SELECT ID, imagename ....> FROM tblbannerimages ....> WHERE ID = #RandRange(1,5)# ....> ....> Then it goes in the banner. ....> ....> <cfoutput><img src="#getimages.imagename#"></cfoutput> ....> ....> .... .... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197197 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

