ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old March 28th, 2005, 08:40 AM
bawaite bawaite is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 84 bawaite User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 50 m 45 sec
Reputation Power: 5
rotating search results

I am working on a business directory currently and I was wondering how could I go about changing the ordering of the search results so that for example:
I have a list of business;
ABusiness
BBusiness
Cbusiness
Dbusiness

and what I would like to do is have a rotating or random result ordering so that when you go to the site, one time it will order them like so

ABusiness
BBusiness
Cbusiness
Dbusiness

but the next you or some one else visits the site it will order them like:

BBusiness
Cbusiness
Dbusiness
ABusiness

and so on for the list so that the business that start with 'Z' will not always be at the bottom of the list.

Any suggestions.

Thank you

Reply With Quote
  #2  
Old March 29th, 2005, 09:37 AM
Bastion Bastion is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 181 Bastion User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 4 h 23 m 47 sec
Reputation Power: 4
I recommend looking into randrange().

Reply With Quote
  #3  
Old March 31st, 2005, 12:24 PM
bawaite bawaite is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 84 bawaite User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 50 m 45 sec
Reputation Power: 5
would that work with a access database, or would it be just for a SQL database?

Reply With Quote
  #4  
Old March 31st, 2005, 12:26 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 8 m 55 sec
Reputation Power: 53
Whatever the function is in Access that generates a random number, you should be able to use in the ORDER BY clause to force the query to come back in a random order.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #5  
Old April 5th, 2005, 10:05 AM
bawaite bawaite is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 84 bawaite User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 50 m 45 sec
Reputation Power: 5
I was not able to find the random function for access that actually made the results random but I was able to put together a work around for the time being:

Code:
<cfloop condition="ListLen(business_list, '%') lt get_business.recordcount">
	
		<cfset rand_num = #RandRange(1, get_business.recordcount)#>
		<cfset next_business = #get_business.bID[rand_num]#>
		<cfif NOT ListFind(business_list, next_business, "%~")>
			<cfset business_list = #business_list# & "%" & #get_business.bID[rand_num]# & "~" & #get_business.bName[rand_num]#
		</cfif>

</cfloop>


Thank you

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > rotating search results


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway