View Single Post

  #1 (permalink)  
Old 06-12-2004
Merlin
 
Posts: n/a
Default PHP/MySQL Delete Row...Automatic Shift Numbers Down?

Hello all!
I'll make it short and sweet...

I have a database, it looks something like this:

id data
--- -------------------------
0 Some Data
1 Some Other Data
2 Some More Other Data


Note:
id = INT NOT NULL PRIMARY KEY
data = TEXT NOT NULL

Now, I:
DELETE FROM whatever WHERE id='1';

Then the ID numbers go "0, 2". Is there a way to _automatically_ shift all
the ID numbers, after the one deleted, to go in order again? I can write a
script to update every row, I just want to know if there is a PHP/MySQL
function that automatically does it.

Thanks!
- Merlin


Reply With Quote