I just posted this in response to a different question.  A note on your 
use of #preservesinglequotes# here - that is inherently unsafe and 
should really be replaced by a cfqueryparam.  As it stands your find 
text could allow a malicious SQL injection to delete tables or pull back 
login names and passwords from your system.

You can do successive finds e.g. get top 300, order by the reverse of 
your original pull then do top 100 on that recordset.  This, of course, 
assumes that you don't have a unique row identifier to do a select where 
id between 200 and 300.  For example:

SELECT TOP 25 t1.*
FROM
(SELECT TOP 50 
service_population,agency,city,state,salary_status,int_agency_id
FROM internships
#preservesinglequotes(find_text)#
ORDER BY agency DESC) t1
ORDER BY t1.agency ASC

Daniel Kessler wrote:

>I have a search (http://hhp.umd.edu/studentservices/internships.cfm). 
>If I have alot of hits in the search results, want to display the 
>first 25 and then do page 1,2,n after that.  Is the idea that I just 
>search for the first 25 with maxrows=25 and then follow a search for 
>the total number to determine the number of additional pages?  The 
>maxrows idea wouldn't allow me to do the page two search would it 
>where I want to just return rows 26-50?
>
>I've not done this type of search/display before so I'm basically 
>looking to see if I'm on the right path and for pointers.
>
>Here's my current search that just returns all results without the pages:
>
><cfset find_text = 'WHERE service_population='Social'> <!--- build a 
>WHERE here--->
><cfquery name="getSearchItem" datasource="dch">
>        SELECT service_population,agency,city,state,salary_status,int_agency_id
>        FROM internships
>        #preservesinglequotes(find_text)#
>        ORDER BY agency ASC
></cfquery>
>
>  
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190977
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to