Why not select out of the database using a random selection of the
indexes that are there?   Then you never have to worry about gaps.
They dont matter.

<CFQUERY DATASOURCE="#Green#" NAME="GetADs" maxrows="1">
 SELECT top 1 *
 FROM dbo.banner_left
ORDER BY newID()
</CFQUERY>

That will select a random record from the table banner_left

Cheers
Mike Kear
Windsor, NSW, Australia
Adobe Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month



On Thu, Dec 4, 2008 at 3:12 PM, Will Tomlinson <[EMAIL PROTECTED]> wrote:
>> I am using a varent from sparty2809 on http://tutorial323.easycfm.com/
>> It works great but was created for ACCESS and uses an autonumber
>> datatype. Its great when you just keep adding advertisments but when
>> you delete one there is now a gap in the +one ADID (int - identity
>> specification).  When the RandRage counts the MAX ADIDs and then picks
>> a ad.  If it hit the number that was deleted it just shows.. nothing.
>> This is a code breaker for me i cant have gaps.
>
>
> Could you convert your query data into an array?
>
> Then get a randRange() using the arraylen().
>
> Then refer to your array with the randRange number.
>
> Will

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316230
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to