Here's a puzzler,...maybe
This is from a CMS that i'm building, i've simplified here.
+----------+------------------+
| manualid | listtext |
+----------+------------------+
| 1 | here some text 1 |
| 2 | here some text 2 |
| 3 | here some text 3 |
| 4 | here some text 4 |
| 5 | here some text 5 |
+----------+------------------+
this table displays in a form, allowing the user to change the values.
the purpose of the manualid field is so the user can re-order the list however
they want.
(when displaying on a webpage the query reads '......Order by manualid'),
i've set the manualid to UNIQUE.
the problem is that when updating via a for loop, for example,
if the user sets manualid 1 to 2, and visa versa 2 to 1,
the update query fails right off because manuald id 2 already exists.
can someone recommend a way to do this?
is there a way to write an multiple updates in 1 query, like there is for insert?
ex.
insert into table (col1, col2 ) values (data1a, data2a), (data1b, data 2b), (data3a, data3b) ..?
OR, should i write to a new table, drop the old one then rename the new one to what the deleted old one was??, that seems like a drastic solution
thanks for any help on this