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> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197191 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=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

