27.11.2013, 15:43
Then don't use auto-increment for that field. Although if you want to keep them in order, then you'll need to update tha field and subtract 1 from it.
So, if you have:
1
2
3
4
5
6
and you remove the number 4, it'll go:
1
2
3
5
6
Then you can update those rows from that field that the value is greater than the value you deleted.
So it'll do:
"UPDATE ... field_here = %d WHERE field_here = %d", 5-1, 5
Just an example, of course it'll be a variable.
So, if you have:
1
2
3
4
5
6
and you remove the number 4, it'll go:
1
2
3
5
6
Then you can update those rows from that field that the value is greater than the value you deleted.
So it'll do:
"UPDATE ... field_here = %d WHERE field_here = %d", 5-1, 5
Just an example, of course it'll be a variable.