Re: Pragmatically changing a "Record Number"

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

 



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 there arn't any gaps in the record number.

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


Do you mean *programmatically*? As the others have pointed out, what you're suggesting would not be very pragmatic at all.

In any case, if what you're after is an accurate method to get the number of records you have, do not rely on max(your_auto_inc_field). Instead, use count(your_primary_key) or mysql_num_rows($result) or $result->numRows() or whatever suits the method you're using to access the DB.

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