It's because that's the way cfoutput works. Try something like this: <cfoutput>
<cfloop index="i" from="1" to="#rows#"> <cfset displayRow = randrange(1, rs.recordcount)> <br /><h3>#displayRow# #rs.first[displayRow]# #rs.last[displayRow]# #rs.flag[displayRow]#</h3><br /> </cfloop> </cfoutput> On Fri, Jan 11, 2013 at 4:17 PM, B Griffith <[email protected]> wrote: > > Hello all! I am new to ColdFusion and web development in general, and > have only had cursory training in programming (Python). > > I have a need for a web page that will accept either an absolute number or > percentile from the end-user (I'm still having trouble w/ the 'form' > functionality of HTML), and then set the variable (or parameter?) "rows" to > the number chosen, then choose THAT number of records at random from the > database (MSSQL). Then I would like to display them (in no particular > order) in plain-old HTML, CSS and other stylization is not important at > this point, solely the functionality of the page. Here is my code: > > <cfquery name="rs" datasource="#application.dsn#"> > SELECT * FROM DONOR > </cfquery> > > <cfset displayRow = randRange(1,rs.recordcount)> > <cfparam name = "rows" default = "5"> > > <cfoutput query="rs" startrow="#displayRow#" maxrows="#rows#"> > <br /><h3>#displayRow# #first# #last# #flag#</h3><br /> > </cfoutput> > > The table name is 'DONOR', and the fields I want to display from it are > 'first', 'last', and 'flag'. I'm wondering at this point why when I run > the page, the output indeed picks a random record to start with, but then > displays the next four sequentially instead of choosing the other four at > random. I am more than happy to post a screencap of my browser output if > need be. Your help is much appreciated as I am quite stumped and I hope > you all can point me in the right direction. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353833 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

