It's a photo album. The unique field is the file name of the image. I have 36 fields for catagories. Each record has either a 0 or a positive integer in each catagory field. Zero in a catagory field denotes that image does not belong to that catagory.
The images are displayed in a specific order, sorted by the contents of the catagory field.
An admin function allows me to change the position of an image on the page, add an image to a page, or remove an image from a page or catagory by changing the number in the catagory field.
As soon as you make any of those kind of changes, you wind up with duplicate or missing numbers within a catagory, causing rows to sort unexpectedly during future updates, so my idea is to go in immedately after each change and renumber.
Doing that though, requires me to update an average of 100 records with the new data for the affected catagory field. I thought that would be no big deal, but issuing that mysql_query("UPDATE... a hundred or two hundred times in a loop, is obviously not the way to do it.
I've been looking at tomhath's suggestions for the last couple of hours, but as far as I can tell that would still use an update loop similar to what I have now, which is where the bottleneck is.
Maybe I need to rethink the logic of the whole thing, start fresh.
John