On Sun, 2011-10-16 at 17:32 -0400, Stephen wrote: > On 11-10-16 04:10 PM, Jim Giner wrote: > > Stephen: > > > > What you describe is a multistep problem. There are many ways to show > > pictures (images) in any order you want. > > ***** > > > > So far, the OP has only asked how to keep his "categories" in order. > > Curious, yes, but he hasn't even asked how to display the images in order - > > maybe he doesn't care about that.. > Well, I want to deal with one part of the design at a time :) > > Thanks to all who replied. This is a collective response. > > Displaying in an order is easy when you have a field called "order". > > SELECT descriptions FROM categories ORDER by order; > > My issue is, say I have three records: > > ID Category Order > > 1 B&W 1 > 2 Landscapes 2 > 3 Nudes 3 > > I am looking for the best way to be able to change the values to > > ID Category Order > > 1 B&W 3 > 2 Landscapes 2 > 3 Nudes 1 > > Dynamically building a form, entering the new order value, and then > looping through the post, with a SQL UPDATE is the best I can come up with. > > > A future issue will be doing the same to the table category-photograph > > ID Category_id photo_id order > > This table is needed to allow a photograph to be in more than one category. > > Cheers > Stephen > It depends on how you're presenting the ordering to the end user. I've used different methods depending on the requirements of the CMS. a) You swap over the order of two items in a list (which could be applicable in your example but the dataset is too small to say) b) You move an item up or down within the list, then you use some queries (take care because multiple queries won't guarantee freedom of DB collisions) to increment or decrement the order of all the items to either side of the item you move up or down, then finally you increment/decrement that individual item. c) Lastly you could allow for a free-form entry for the order field, and allow for multiple items to share the same order. A cleanup routine could then arrange them properly during quiet periods for example if you're worried about order field collision. With any of these methods I'd swing for using transactions if you can, because you're going to be performing multiple queries and the system may be used by other people at the same time. -- Thanks, Ash http://www.ashleysheridan.co.uk