Reply to Re: [PHP] Fixing ID's in mySQL Table

Your name:

Reply:


Posted by "Richard Lynch" on 10/20/08 11:31

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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация