Re: [PHP] record ID problem

2004-12-03 Thread Richard Lynch
Ahmed Abdel-Aliem wrote:
> Hi,
> i have a script which reads and edit and delete records from a database
> table.
> the proplem is i nthe ID field.
> when i delete a row the sequence of numbers still the same, i need a
> function which return the IDs in the form of 1 2 3 4 5 6 7 8 9
> instead of  1 3 7 9,
> can anyone help me plz ?

But you *WANT* those ID numbers to be "missing"!

They've been deleted.  Leave them alone.

If you use the ID to relate this table to some other table, you *NEED*
those numbers to be "gone" so that the other table knows the record was
deleted.

This is a perennial question from newbie database users, who think they
want their IDs to always be sequential, with no "holes"

Trust us.

You don't want that.

Now, whereever you *DO* want 1, 2, 4, 5, 6, 7, 8, 9, just figure out a way
to get that there, using something *OTHER* than the ID field.

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



Re: [PHP] record ID problem

2004-12-03 Thread John Holmes
Ahmed Abdel-Aliem wrote:
i have a script which reads and edit and delete records from a database table.
the proplem is i nthe ID field.
when i delete a row the sequence of numbers still the same, i need a
function which return the IDs in the form of 1 2 3 4 5 6 7 8 9
instead of  1 3 7 9, 
can anyone help me plz ?
How about you describe what you're trying to do instead of what you 
think you need to accomplish it. If you need a continuous count, then 
use a variable and start a counter as you print out rows. If holes in 
your record ID column is messing up your application, you're using it 
for the wrong reasons.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] record ID problem

2004-12-03 Thread Ahmed Abdel-Aliem
Hi,
i have a script which reads and edit and delete records from a database table.
the proplem is i nthe ID field.
when i delete a row the sequence of numbers still the same, i need a
function which return the IDs in the form of 1 2 3 4 5 6 7 8 9
instead of  1 3 7 9, 
can anyone help me plz ?

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