Re: record ID problem
| From: | Richard Lynch | Date: | Fri, 03 Dec 2004 18:52:14 +0000 |
| Subject: | Re: record ID problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-203455@lists.php.net to get a copy of this message | ||
Ahmed Abdel-Aliem wrote:
> Hi,
> i have a script which reads and edit and delete records from a database
> table.
> the proplem is i nthe ID field.
> when i delete a row the sequence of numbers still the same, i need a
> function which return the IDs in the form of 1 2 3 4 5 6 7 8 9
> instead of 1 3 7 9,
> can anyone help me plz ?
But you *WANT* those ID numbers to be "missing"!
They've been deleted. Leave them alone.
If you use the ID to relate this table to some other table, you *NEED*
those numbers to be "gone" so that the other table knows the record was
deleted.
This is a perennial question from newbie database users, who think they
want their IDs to always be sequential, with no "holes"
Trust us.
You don't want that.
Now, whereever you *DO* want 1, 2, 4, 5, 6, 7, 8, 9, just figure out a way
to get that there, using something *OTHER* than the ID field.
--
Like Music?
http://l-i-e.com/artists.htm