Re: [PHP] Pragmatically changing a Record Number

2007-09-05 Thread tedd
At 9:04 PM -0400 9/4/07, brian wrote: You're being pissy again. It really reflects poorly on you and, i suspect, it's keeping you from truly understanding what it is that i'm trying to help you with. Enough said on this subject, besides I don't think you're reading what I write correctly

Re: [PHP] Pragmatically changing a Record Number

2007-09-04 Thread tedd
At 6:18 PM -0400 9/3/07, brian wrote: Renumbering anything is pretty quick these days. To me, things that are horribly inefficient are also slow. So, I don't agree. If I remember correctly, I can even renumber a 100K item dB auto_increment index in less than one second -- but I wouldn't

Re: [PHP] Pragmatically changing a Record Number

2007-09-04 Thread Graham Cossey
Surely we're into basic database design. If you have an auto_increment record key that needs changing from time to time then you've designed the database incorrectly. Use a 'normal' key field such as Product_Id and have your application generate the number. Simple. No? On 9/4/07, tedd [EMAIL

Re: [PHP] Pragmatically changing a Record Number

2007-09-04 Thread brian
tedd wrote: At 6:18 PM -0400 9/3/07, brian wrote: It may be just fine in your case, but from a DB design standpoint it most certainly is not efficient. Why re-order the entire table for something like this? Altering an entire table because one row has been deleted suggests to me that the

Re: [PHP] Pragmatically changing a Record Number

2007-09-04 Thread tedd
At 12:11 PM -0400 9/4/07, brian wrote: tedd wrote: At 6:18 PM -0400 9/3/07, brian wrote: It may be just fine in your case, but from a DB design standpoint it most certainly is not efficient. Why re-order the entire table for something like this? Altering an entire table because one row has

Re: [PHP] Pragmatically changing a Record Number

2007-09-04 Thread brian
tedd wrote: At 12:11 PM -0400 9/4/07, brian wrote: You are confusing a product ID with this index number. They are very much not the same thing. A product ID (PLU, serial #, whatever) should not change. This index does change, any time a row is removed from the database. How can you suggest

Re: [PHP] Pragmatically changing a Record Number

2007-09-03 Thread tedd
At 10:27 AM +1000 9/3/07, Chris wrote: tedd wrote: At 6:14 PM -0400 9/2/07, brian wrote: tedd wrote: Hi to the original poster: Snip -- a lot of discussion Use the following code at your own peril. $dbQuery = ALTER TABLE $dbtable ; $dbQuery .= DROP id, ; $dbQuery .= ADD id INT UNSIGNED NOT

Re: [PHP] Pragmatically changing a Record Number

2007-09-03 Thread brian
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)

Re: [PHP] Pragmatically changing a Record Number

2007-09-03 Thread tedd
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

Re: [PHP] Pragmatically changing a Record Number

2007-09-03 Thread brian
tedd wrote: At 11:48 AM -0400 9/3/07, brian wrote: 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

Re: [PHP] Pragmatically changing a Record Number

2007-09-03 Thread tedd
At 3:17 PM -0400 9/3/07, brian wrote: tedd wrote: 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.

Re: [PHP] Pragmatically changing a Record Number

2007-09-03 Thread brian
tedd wrote: At 3:17 PM -0400 9/3/07, brian wrote: Well, yes, that would work also but is horribly inefficient because the *entire table* must be altered any time a row is deleted. horribly inefficient? Renumbering anything is pretty quick these days. To me, things that are horribly

Re: [PHP] Pragmatically changing a Record Number

2007-09-02 Thread Graham Cossey
If I've understood correctly your record/Id number relates to a message/post. Let's say the PHP list has message numbers and this post is number 456. If I have a list of posts and sort them by user and provide the user with a numbered list of posts from 1 to N in user sequence there's VERY little

Re: [PHP] Pragmatically changing a Record Number

2007-09-02 Thread tedd
Hi to the original poster: Snip -- a lot of discussion Use the following code at your own peril. $dbQuery = ALTER TABLE $dbtable ; $dbQuery .= DROP id, ; $dbQuery .= ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT,; $dbQuery .= AUTO_INCREMENT = 1; $result = mysql_query($dbQuery) or die(Could not

Re: [PHP] Pragmatically changing a Record Number

2007-09-02 Thread brian
tedd wrote: Hi to the original poster: Snip -- a lot of discussion Use the following code at your own peril. $dbQuery = ALTER TABLE $dbtable ; $dbQuery .= DROP id, ; $dbQuery .= ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT,; $dbQuery .= AUTO_INCREMENT = 1; $result = mysql_query($dbQuery) or

Re: [PHP] Pragmatically changing a Record Number

2007-09-02 Thread tedd
At 6:14 PM -0400 9/2/07, brian wrote: tedd wrote: Hi to the original poster: Snip -- a lot of discussion Use the following code at your own peril. $dbQuery = ALTER TABLE $dbtable ; $dbQuery .= DROP id, ; $dbQuery .= ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT,; $dbQuery .= AUTO_INCREMENT =

Re: [PHP] Pragmatically changing a Record Number

2007-09-02 Thread Chris
tedd wrote: At 6:14 PM -0400 9/2/07, brian wrote: tedd wrote: Hi to the original poster: Snip -- a lot of discussion Use the following code at your own peril. $dbQuery = ALTER TABLE $dbtable ; $dbQuery .= DROP id, ; $dbQuery .= ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT,; $dbQuery .=

Re: [PHP] Pragmatically changing a Record Number

2007-09-01 Thread Bill Guion
I don't think you really want to do that, either. You don't need a field in the database to accomplish what you are trying to do. Execute your query to select the records you want, sorting them into what ever order you want. When you display the records on your web page, add a PHP variable,

Re: [PHP] Pragmatically changing a Record Number

2007-08-30 Thread Stut
Jason Pruim wrote: Hi Everyone, Hi Dr Jason. I think after I get this question answered, I can stop asking for awhile since my project will be done, at least until the users say What happened to XYZ then I'll ask again :) I asked on a MySQL list about Resetting a auto increment filed

Re: [PHP] Pragmatically changing a Record Number

2007-08-30 Thread M. Sokolewicz
Stut wrote: Jason Pruim wrote: Hi Everyone, Hi Dr Jason. I think after I get this question answered, I can stop asking for awhile since my project will be done, at least until the users say What happened to XYZ then I'll ask again :) I asked on a MySQL list about Resetting a auto

Re: [PHP] Pragmatically changing a Record Number

2007-08-30 Thread Jason Pruim
On Aug 30, 2007, at 5:14 AM, Stut wrote: Jason Pruim wrote: Hi Everyone, Hi Dr Jason. I think after I get this question answered, I can stop asking for awhile since my project will be done, at least until the users say What happened to XYZ then I'll ask again :) I asked on a MySQL

Re: [PHP] Pragmatically changing a Record Number

2007-08-30 Thread Stut
M. Sokolewicz wrote: Stut wrote: Jason Pruim wrote: Hi Everyone, Hi Dr Jason. I think after I get this question answered, I can stop asking for awhile since my project will be done, at least until the users say What happened to XYZ then I'll ask again :) I asked on a MySQL list

Re: [PHP] Pragmatically changing a Record Number

2007-08-30 Thread Stut
Jason Pruim wrote: On Aug 30, 2007, at 5:14 AM, Stut wrote: Jason Pruim wrote: Hi Everyone, Hi Dr Jason. I think after I get this question answered, I can stop asking for awhile since my project will be done, at least until the users say What happened to XYZ then I'll ask again :) I

Re: [PHP] Pragmatically changing a Record Number

2007-08-30 Thread Jason Pruim
On Aug 30, 2007, at 6:34 AM, Stut wrote: Jason Pruim wrote: On Aug 30, 2007, at 5:14 AM, Stut wrote: Jason Pruim wrote: Hi Everyone, Hi Dr Jason. I think after I get this question answered, I can stop asking for awhile since my project will be done, at least until the users say What

Re: [PHP] Pragmatically changing a Record Number

2007-08-30 Thread Stut
Jason Pruim wrote: The information is being displayed in a table, and can be sorted by any of the fields. The purpose of the application I am writing is going to be a online database, giving my customers access to their mailing list 24/7 from anywhere in the world. Alot of the customers that

Re: [PHP] Pragmatically changing a Record Number

2007-08-30 Thread Jason Pruim
On Aug 30, 2007, at 6:52 AM, Stut wrote: Jason Pruim wrote: The information is being displayed in a table, and can be sorted by any of the fields. The purpose of the application I am writing is going to be a online database, giving my customers access to their mailing list 24/7 from

[PHP] Pragmatically changing a Record Number

2007-08-29 Thread Jason Pruim
Hi Everyone, I think after I get this question answered, I can stop asking for awhile since my project will be done, at least until the users say What happened to XYZ then I'll ask again :) I asked on a MySQL list about Resetting a auto increment filed so that there arn't any gaps in

RE: [PHP] Pragmatically changing a Record Number

2007-08-29 Thread Jay Blanchard
[snip] Is there away with PHP that I can pragmatically change that value to the total records in the database more so then a representation of the actual record number? [/snip] 1. Changing the values in an auto-increment column is just Bad[tm], especially if you are using it as a unique

Re: [PHP] Pragmatically changing a Record Number

2007-08-29 Thread Jason Pruim
On Aug 29, 2007, at 1:58 PM, Jay Blanchard wrote: [snip] Is there away with PHP that I can pragmatically change that value to the total records in the database more so then a representation of the actual record number? [/snip] 1. Changing the values in an auto-increment column is just

Re: [PHP] Pragmatically changing a Record Number

2007-08-29 Thread Jim Lucas
Jason Pruim wrote: 3. Ask yourself, Is it important to keep the auto-increment field contiguous? The main reason for changing it is I do currently have an option to sort by record number, although, if I add a Record number in php, but still have it sort based off of the record number stored

Re: [PHP] Pragmatically changing a Record Number

2007-08-29 Thread Stephen
--- Jason Pruim [EMAIL PROTECTED] wrote: So to say it another way, I have a table that has 900 records in it, I've added 3 records, but then deleted 2 of those which puts the actual record count at 901 but my auto increment field starts at 904 on the next insert. Is there away

Re: [PHP] Pragmatically changing a Record Number

2007-08-29 Thread brian
Jason Pruim wrote: Hi Everyone, I think after I get this question answered, I can stop asking for awhile since my project will be done, at least until the users say What happened to XYZ then I'll ask again :) I asked on a MySQL list about Resetting a auto increment filed so that

Re: [PHP] Pragmatically changing a Record Number

2007-08-29 Thread James Ausmus
On 8/29/07, Stephen [EMAIL PROTECTED] wrote: --- Jason Pruim [EMAIL PROTECTED] wrote: So to say it another way, I have a table that has 900 records in it, I've added 3 records, but then deleted 2 of those which puts the actual record count at 901 but my auto increment field starts at

Re: [PHP] Pragmatically changing a Record Number

2007-08-29 Thread Richard Lynch
On Wed, August 29, 2007 12:49 pm, Jason Pruim wrote: I think after I get this question answered, I can stop asking for awhile since my project will be done, at least until the users say What happened to XYZ then I'll ask again :) I asked on a MySQL list about Resetting a auto increment

Re: [PHP] Pragmatically changing a Record Number

2007-08-29 Thread Jason Pruim
On Aug 29, 2007, at 3:02 PM, Richard Lynch wrote: On Wed, August 29, 2007 12:49 pm, Jason Pruim wrote: I think after I get this question answered, I can stop asking for awhile since my project will be done, at least until the users say What happened to XYZ then I'll ask again :) I asked

Re: [PHP] Pragmatically changing a Record Number

2007-08-29 Thread Jason Pruim
On Aug 29, 2007, at 2:41 PM, Stephen wrote: --- Jason Pruim [EMAIL PROTECTED] wrote: So to say it another way, I have a table that has 900 records in it, I've added 3 records, but then deleted 2 of those which puts the actual record count at 901 but my auto increment field starts at 904 on

Re: [PHP] Pragmatically changing a Record Number

2007-08-29 Thread Jason Pruim
On Aug 29, 2007, at 2:27 PM, Jim Lucas wrote: Jason Pruim wrote: 3. Ask yourself, Is it important to keep the auto-increment field contiguous? The main reason for changing it is I do currently have an option to sort by record number, although, if I add a Record number in php, but still

RE: [PHP] Pragmatically changing a Record Number

2007-08-29 Thread Bastien Koert
-general@lists.php.net From: [EMAIL PROTECTED] Date: Wed, 29 Aug 2007 13:49:02 -0400 Subject: [PHP] Pragmatically changing a Record Number Hi Everyone, I think after I get this question answered, I can stop asking for awhile since my project will be done, at least until the users say What