Actually, what I had in mind was something like this:

<cfquery name = "getRange" etc>
select min(photoID) as low, max(photoID) as high
from photos
<cfquery>

<cfset searchID = randRange(getRange.low, getRange.high)>

<cfquery name = "getPhoto">
select photo from photos
where photoID = #searchID#
<cfquery>


That is the general idea.  You would have to add some error checking to
ensure that there actually is a record for searchID.

As an aside, the database engine I normally use does not have any random
functions that I know about, so I did not consider any solutions along
those lines.

***************************
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>




-
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)

Reply via email to