Re: Seeking strategy/algorithm for maintaining order of records
| From: | Stephen | Date: | Sun, 16 Oct 2011 21:32:39 +0000 |
| Subject: | Re: Seeking strategy/algorithm for maintaining order of records | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-315327@lists.php.net to get a copy of this message | ||
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 3I 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 1Dynamically 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