Thanks Dan.  I ended up doing the following (which seems to work fine), but
wasn't 100% sure if it's the way you were talking about:

<cfquery name="getPhoto" datasource="dsn">
    select items from db table
</cfquery>

<cfset start = 1>
<cfset end = getPhoto.recordcount>
<cfoutput query="getPhoto" startrow="#RandRange(start,end)#" maxrows="1">
<img src="photos/#photo#">
</cfoutput>

Blessings,

Graham

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 31, 2002 10:21 AM
Subject: [CFTALKTor] random selection from database


> You could run a query to get the min and max, then use RandRange to get
> your random id.  That should get you started.
>
> *******************
> Hi there,
>
> An easy one for a Friday morning...
>
> I have a table that lists submitted photos, and would like to have a
random
> photo generator that reads from this table in the database.  What's the
> best
> way to select one random PhotoID from the table and then use it within a
> <cfoutput> to display a photo?
>
>
>
> -
> You are subscribed to the CFUGToronto CFTALK ListSRV.
> This message has been posted by: [EMAIL PROTECTED]
> To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
> Manager: Kevin Towes ([EMAIL PROTECTED])
http://www.CFUGToronto.org/
> This System has been donated by Infopreneur, Inc.
> (http://www.infopreneur.net)
>

-
You are subscribed to the CFUGToronto CFTALK ListSRV.
This message has been posted by: "Graham Faulkner" 
<[EMAIL PROTECTED]>
To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
Manager: Kevin Towes ([EMAIL PROTECTED]) http://www.CFUGToronto.org/
This System has been donated by Infopreneur, Inc.
(http://www.infopreneur.net)

Reply via email to