Re: Pragmatically changing a "Record Number"

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

 



At 11:48 AM -0400 9/3/07, brian wrote:
tedd wrote:
At 10:27 AM +1000 9/3/07, Chris wrote:

tedd wrote:

At 6:14 PM -0400 9/2/07, brian wrote:

tedd wrote:

How is that contrary to what I said?

You are actually changing the id's in the database.

Brian's example is making up an id to display (much like the excel row numbers) rather than actually changing the id in the database.

Please read what I said above, If you do, then you will see that I advised against altering the index and recommend setting up another field for displaying a record sequence.


It seemed to me that what you were suggesting was to either alter the existing id or to create a second auto_increment field. Isn't there already an auto_increment field in the table? I thought that that was what this was all about: an increment that has gaps.

In any case, i can't see how that would help considering that, should any of the rows then be deleted, we're back to the same problem: the auto_increment field will have a gap. That's why the simplest way to deal with this is to increment a counter var in the presentational logic, given that this counter is for presentational purposes only and is unnecessary to relate to any specific row. That's what the existing id column is for (however "out of order" it may be).

brian

Arrggg. No, I did not say create another auto_increment field -- I said:

Quote
The reason for not wanting to care about the auto_increment id is that it is something that the database uses and really should not be changed. If you want to have a sequential record number, then add that field and alter it as you will, but leave the internal workings of database alone.
Un-quote

Now, I do not know why what I said seemed to mean something different to you, but my guess is that you didn't read it thoroughly.

As for the "gap" problem, there is no gap problem if you create another field for record number and alter it to your liking (NOTE: I did not say AUTO_INCREMENT). If you add/delete a record, then adjust the "field for record number" accordingly. You don't have to adjust the database's index to handle gaps.

I don't see the problem here other than misunderstanding what's been said.

Cheers,

tedd


--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
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