Re: Fixing ID's in mySQL Table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, November 8, 2005 7:37 am, Rahul S. Johari wrote:
> Is there a way to fix ID sequence in a MySQL table using PHP?
> Basically I have some tables with a  lot of records, 1000 to 5000.
> ?ID¹ is
> the Primary Key column in these tables, and at the time the code was
> originally written, there weren¹t much verification of data being
> input
> going on. Thus a lot of junk records were being let in, which had to
> be
> deleted at some point or another. Now the ID sequence is all screwed
> up.
> It¹s not in sequence anymore.
>
> Is there a way to fix this?

Don't.

Your IDs should not have to be in sequence, nor consecutive, nor even
in order.

If any portion of you application relies on the IDs being any
particular values, your application is broken in the first place.

You've got 2 BILLION available ID numbers. (4 billion if it's unsigned).

The fact that MySQL uses consecutive integers should be considered
more of a fluke of nature than a fact of life.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux