Depends on which database you're using.

With mySQL, you can do this:

SELECT id, name
FROM tablename
LIMIT 0,9

The 0 indicates where to start, and the 9 indicates how many records to return. 
Used in conjunction with a URL based paging system, that query might look like 
this:

SELECT id, name
FROM tablename
LIMIT <cfqueryparam value="#URL.page#" cfsqltype="cf_sql_integer">,9
 

-----Original Message-----
From: Riaan Venter [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 16, 2007 3:18 AM
To: CF-Talk
Subject: Breaking up a DB query into pages

Hi

What would be the best way to only show 9 results from a DB query on a page and 
then have a next button and show the next 9 there after, and so on.

Do I have to read the query into a structure or is there a way I can use the 
<cfloop> function.

Thanks!



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283745
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to