Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Problem with RandRange function

Posted on 2004-10-29
3
Medium Priority
?
268 Views
Last Modified: 2013-12-24
I am trying to use the randrange function to randomize some banners I have.  Problem is, it doesn't seem to be going any higher then the number 4

<cfif #story.categoryID# eq 3 OR #story.categoryID# eq 9 OR #story.categoryID# eq 13>
                  <cfparam name="bannerswap" default="#randrange(1, 5)#">
                  <cfif bannerswap is "1">
                        <cfinclude template="random1.cfm">
                  <cfelseif bannerswap is "2">
                        <cfinclude template="random2.cfm">
                  <cfelseif bannerswap is "3">
                        <cfinclude template="random3cfm">
                  <cfelseif bannerswap is "4">
                        <cfinclude template="random4.cfm">
                  <cfelseif bannerswap is "5">
                        <cfinclude template="random5.cfm">
                  </cfif>
            <cfelse>
                  <cfparam name="bannerswap" default="#randrange(1, 7)#">
                  <cfif bannerswap is "1">
                        <cfinclude template="random6.cfm">
                  <cfelseif bannerswap is "2">
                        <cfinclude template="random7.cfm">
                  <cfelseif bannerswap is "3">
                        <cfinclude template="random8.cfm">
                  <cfelseif bannerswap is "4">
                        <cfinclude template="random9.cfm">
                  <cfelseif bannerswap is "5">
                        <cfinclude template="random10.cfm">
                  <cfelseif bannerswap is "6">
                        <cfinclude template="random11.cfm">
                  <cfelseif bannerswap is "7">
                        <cfinclude template="random12.cfm">
                  </cfif>
            </cfif>

Notice how I have 1, 7   or 1, 5.  Well, I cfoutputed   bannerswap and it would never go above the number 4. It would do 1,2,3,4 but never 5,6,7.

Why is that.

Thanks
Bryan
0
Comment
Question by:jag5311
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
Renante Entera earned 200 total points
ID: 12450160
Hello jag5311!

How about changing the following codes :
  <cfparam name="bannerswap" default="#randrange(1, 5)#">
  <cfparam name="bannerswap" default="#randrange(1, 7)#">

Into these codes :
  <cfset bannerswap = randrange(1, 5)>
  <cfset bannerswap = randrange(1, 7)>

Hope this helps.  Just try it.


Goodluck!
eNTRANCE2002 :-)
0
 

Author Comment

by:jag5311
ID: 12450429
genious. Pure genious :)

I got this off of easycfm.com.

So far it worked I will let you know and award points.

Thanks
0
 

Author Comment

by:jag5311
ID: 12450458
THANK YOU! Works wonderfully. And funny, but it seems like its faster to in terms of how fast my banners show up or get decided to show.
0

Featured Post

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question