Quick and dirty...

Give the db table a numeric 'sortid' to sort the query by then use this....

<cfparam name="url.recordid" default="0">
<cfparam name="url.act" default="">

<cfif url.act is "increase">
        <cfquery datasource="mydsn">
        Update tbl_records
        Set sortid = sortid + 1
        Where recorded = #val(url.recordid)#
        </cfquery>      
<cfelseif url.act is "decrease">
        <cfquery datasource="mydsn">
        Update tbl_records
        Set sortid = sortid - 1
        Where recorded = #val(url.recordid)#
        </cfquery>      
</cfif>

<cfquery name="rs" datasource="mydsn">
Select * from tbl order by sortid
</cfquery>

<table>
<cfloop query="rs">
<tr>
<td>#recordname#</td>
<td><a href="index.cfm?recordid=#recordid#&act=increase">Up</a></td>
<td><a href="index.cfm?recordid=#recordid#&act=decrease">Down</a></td>
</tr>
</cfloop>
</table>




-----Original Message-----
From: Don R Seibert [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 11, 2005 7:31 PM
To: CF-Talk
Subject: Using arrow buttons to sort data

I'm sure it has been done a million times. I would like to sort data
presented in a table (alphanumeric) by pushing small arrow buttons
ascending or descending order. Can some point to a place or provide a
snippet of code to accomplish this?

 

Thank you,

 

Don





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206492
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=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to