I'm passing an id, a numeric value in a URL.value. That id value indentifies the
primary key id of a record in my db. Based on that value, I want to
get the group of records in the db that surround that  value in groups of 10.
This is used to display other hyperlinked items in the same group.  I'm 
basically 
creating page views showing links of these items in these groups. I want to 
display
the groups of the first 1-10, 11-20, 21-30 etc entries in the db. However some 
records have been deleted, so some of the existing primary key ids are not 
sequntial, 
the second group of 10 id values might be 11,13,14,16,17,19,22,23,24,25. I've 
got the code that will idenifiy what group level I am in when the URL.ID is 
passed. 

QUESTION: Now I need to figure out how to extract the group of non-sequential 
ids 
to extract from the db. Hope this makes sense.

Here's what I have,

<cfset start = (int(url.video_id/10) * 10) + 1>
<CFSET end=(int(url.video_id/10)+1)*10>

<CFIF start EQ 1 AND end EQ 10>
 <CFSET on_page = 1>
 <CFSET next_page = 2>
<CFELSEIF start EQ 11 AND end EQ 20>
 <CFSET on_page = 2>
 <CFSET next_page = 3>
 <CFSET previous_page = 1> 
<CFELSEIF start EQ 21 AND end EQ 30>
 <CFSET on_page = 3>
 <CFSET next_page = 4>
 <CFSET previous_page = 2>
and so on ...

TO extract the set of rows, I need to take the id and indentify where I am in 
these
groups of 10.  So id 43 would be 2 away from 41 and 7 away from 50. How do
I implement that into a query?  Or should I be using cf logic first?

<!--- TELLS ME HOW MANY ROWS I AM AWAY FROM MY STARTINIG ROW--->
<CFSET from_1 = URL.VIDEO_ID - start> 
<!--- TELLS ME HOW MANY ROWS I AM AWAY FROM MY STARTINIG ROW --->
<CFSET from_2 = end - URL.VIDEO_ID> 

How do I write this query?

D-

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:251124
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