I'm trying to make an admin screen for a photographer. He want to be able to
be able to reorder photographs at will.
I'm running into problems
TABLE:photos (simplified)
ID
photoURL
photoORDER (are multiples of 10)
First step (simplified) is updating the table
OK, so far no problems. If I move photo 50 in front of phot 30 the
photoOrder changes from
10,20,30,40,50
to
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.
<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>
The problem is that if I change
10-20-30-40-50
to
10-20-19-40-50
after running updatePhotos it becomes
10-30-30-40-50
This is driving me crazy.
Gil Midonnet
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137746
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
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community.
http://www.fusionauthority.com/ads.cfm