Oh you want to diplay ALL of the banners, I read that wrong :)

<!--- get the query --->
<cfquery name="qryName" ...>
SELECT *
FROM banners
</cfquery>

<!--- build your list --->
<cfset bannerList = "">
<cfloop from="1" to="#qryName.recordcount#" index="I">
<cfset bannerList = listAppend(bannerList, i)>
</cfloop>


<!--- output random banners --->
<cfoutput query="qryName">
<cfset rndNum = RandRange(1,listlen(bannerList))>
<cfset rowNum = listgetat(bannerlist, rndNum)>

#qryName.bannerimage[rowNum]#

<cfset bannerList = ListDeleteAt(bannerList, rowNum)>
</cfoutput>

That would loop through the list, grabbing a random number from the
list, then delete it before looping through the list again, it should be
truly random.

______________________
steve oliver
atnet solutions, inc.
http://www.atnetsolutions.com


-----Original Message-----
From: Double Down [mailto:[EMAIL PROTECTED]] 
Sent: Friday, February 01, 2002 4:55 PM
To: CF-Talk
Subject: Output Question


I am pulling records from a DB that display banners. I want to display
all of the banners, however I would like to rotate their display
position so the first record pulled is not always the first one
displayed.  Any ideas?
 
DDINC
 


______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to