We used the code below to get random products out of the database

<cfquery datasource="extdata" name="queryname">
 select *
 from osprods
</cfquery>

<!--- Using randrange, between 1 and the total number of records to get a
random number --->
<cfset thisrow=RandRange(1,#queryname.RecordCount#)>

    <cfoutput query="numprod" startrows="#thisrow#" maxrows="1">
        ....output code here...
    </cfoutput>

I think this might help you out... let me know

Paul Giesenhagen
QuillDesign
http://www.quilldesign.com
SiteDirector - Commerce Builder


----- Original Message -----
From: "Mark A. Kruger - CFG" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, February 13, 2002 1:30 PM
Subject: Random row from SQL


> A while back someone posted some code to generate a random number between
> two numbers using SQL.  I'd like to be able to do that.  I want to be able
> to return a random row from among rows in an ad database.  Does anyone
have
> ideas on how this might be accomplished?
>
> Mark
> 
______________________________________________________________________
Get Your Own Dedicated Windows 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=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to