Don't you have a PK? WHERE photoID = #reorderPhotos.photoID# or something like that. The problem is you are updating the field you are filtering on: 10 -> 10 20 -> 20 29 -> 30 (and there is already a record with photoOrder 30) 30,30 (2 records now) -> 40,40 40,40,40 (3 records now) -> 50,50,50
-----Oorspronkelijk bericht----- Van: mayo [mailto:[EMAIL PROTECTED] Verzonden: ma 22/09/2003 14:00 Aan: CF-Talk CC: Onderwerp: reindexing a field -- having problems I would like to be able to reindex a field. I'm trying to create an admin screen that allows uses to reorder items. The question is -- how to reindex the field after the user updates the table. Say the original order is 10,20,30,40,50 and the user places 50 in front of 30. The new order 10,20,29,30,40 So far no problem. Everything works out nicely Now what I would like to do is to reorder the photoOrder so that it once again becomes 10,20,30,40,50. The problem is that it becomes 10-20-50-50-50 This is driving me crazy. The Cold Fusion is below: <cfquery name="reorderPhotos" datasource=""> SELECT * FROM photos ORDER BY photoOrder </cfquery> <cfloop query="reorderPhotos"> <cfoutput> <cfset times10=#reorderPhotos.currentRow#*10> <cfquery name="updatePhotos" datasource=""> UPDATE photos SET photoOrder = #times10# WHERE photoOrder = #reorderPhotos.photoOrder# </cfquery> </cfoutput> </cfloop> TIA, Gil Midonnet *Archives: http://www.OpenITx.com/g/access-l.asp *Manage Subscriptions: http://My.ITtoolbox.com *Leave Group: mailto:[EMAIL PROTECTED] *Need Subscription Help? mailto:[EMAIL PROTECTED] *Terms of Use: http://www.ittoolbox.com/help/termsofuse.htm *Copyright (c) ITtoolbox and message author. No redistribution ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137880 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com