Hi,
i have the following dilemma:
client wants to have a simple database with three fields where they want to be able to change ID field by themselves.
Simple as it is :
ID text text
1 --- ---
2 --- ---
3 --- ---
4 --- ---
What confused me was a required abillity to add entries into the middle of DB, and that in the case a new entry is added (or an existing entry has its ID modified) in the middle, the subsequent rows would have their ID number increased :
primary table:
ID text text
1 --- ---
2 new new
3 --- ---
4 --- ---
5 --- ---
Right now i think of solving the problem with:
1. checking whether new entry's ID($entryID) number is lower than the biggest in the table.
- if it is, create a temporary table, and fill it with "SELECT * into temporary_table WHERE id>= $entryID"
3.update $entryID with new data
delete all fields from primary_table with a greater ID than $entryID
increase all ID numbers in temporary_table by one and merge
it back with the primary_table
Kinda tricky for one operation. =\
Perhaps somebody here can suggest a more short/efficient way to do it?