If you are using SQL Server, you could do this:

SELECT TOP 1 ID, imagename
FROM tblbannerimages
ORDER BY  NewID()


On Wed, 02 Mar 2005 16:34:40 -0400, Will The Game <[EMAIL PROTECTED]> wrote:
> Question: Why couldn't I use RandRange in a query to rotate a banner image? I 
> usually use JS buit it looks like a bunch of crap code. *This* would be 
> simple.
> 
> I have a tblbannerimages with ID# as PK, imagename is like image1.jpg or 
> whatever.
> 
> ID's would be 1, 2, 3, 4, 5 let's say
> 
> Now I run a query to retrieve one to output it to the banner everytime the 
> page loads.
> 
> SELECT ID, imagename
> FROM tblbannerimages
> WHERE ID = #RandRange(1,5)#
> 
> Then it goes in the banner.
> 
> <cfoutput><img src="#getimages.imagename#"></cfoutput>
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197201
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to