Search Results

How can I show a limited number of search results per page?

Page 1 of 1

1 Replies - 1704 Views - Last Post: 10 December 2009 - 07:30 PM Rate Topic: -----

#1 nici2508  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 09-December 09

Search Results

Posted 10 December 2009 - 02:23 AM


At the moment my search results page shows all results on one page so the user has to scroll right down to see them all, how can i edit the code below to limit results to 10 per page and have a link to see 1-10 of results 11-20 of results or something similar?



<span class="text">
  <cfif len(#searchterm#) eq 0>
		  <cflocation addtoken="no" url="searchdj.cfm?message=error" />

		<cfquery name="q1" datasource="BTS2009">
select * from contact
where artist like '%#searchterm#%'

	 <span class="heading">Results</span><br />
	 Search results will display all closest matches in the artist category selected. 
	 <span class="text">
<cfif q1.recordcount gt 0>
<cfoutput query="q1"><br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
		  <td width="25%" align="left" valign="top"><span class="heading">Artist ID:</span><br /><span class="heading">Artist Genre:</span><br />
			<span class="heading">Username:<br /></span><span class="heading">Gender:<br />
			</B></span><span class="heading">Plays:<br />
			</span><span class="heading">Available in:<br /></span><span class="heading"><br /></span></td>
		  <td width="34%" align="left" valign="top"><span class="text">#q1.artist#</span><br /><span class="text"></span><br /><span class="text">#q1.username#<br /></span><span class="text">#q1.gender#<br /></span><span class="text"><br /></span><span class="text"><br />
		  </span><span class="text"><br /></span><span class="bodytext"></span></td>
		  <td width="41%" valign="top"><img src="../images/#username#.jpg" alt="#q1.firstname#, #q1.surname#" /></td>
		  <td valign="top" class="text"><a href="viewprofile.cfm?id=#id#">View Profile</a></td>
		<br /><br />

<p class="heading">Sorry no matches were found.</p>

Is This A Good Question/Topic? 0
  • +

Replies To: Search Results

#2 xheartonfire43x  Icon User is offline

  • D.I.C Regular

Reputation: 46
  • View blog
  • Posts: 454
  • Joined: 22-December 08

Re: Search Results

Posted 10 December 2009 - 07:30 PM

Hi Nicola,

This might help you It is a CFC for creating Pageination. I have not used it before, but have heard good things about it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1