>I have a primary key listed as ID
>
>When I first added about 10 records and then deleted a few records and
>then added more records it didn't replace the missing records.
>
>When I select all records to view I now get:
>
>1
>2 why didn't it go to 3, 4 and 5 after 2?
>6
>7
>8
>
>
>
>When I add a record it becomes record 11. Am I doing something wrong
>when I delete a record? I thought it would move the other records down
>6 and 7 would be 3 and 4 etc...
>
>Using RedHat Linux with latest MySQL rpms: mysql-server-3.23.32-1.7
>php-mysql-4.0.4pl1-3
>mysql-devel-3.23.32-1.7
>mysqlclient9-3.23.22-3
>mysql-3.23.32-1.7
Sir, you don't say if you declared your primary key with
auto_increment, but it appears as though you did. Other people have
already explained about auto_increment, so I'll just point out that
you can use REPLACE instead of DELETE and INSERT, and it will delete
rows where the primary key matches the primary key in the new rows,
and then insert the new rows. This will avoid 'holes'.
Bob Hall
Know thyself? Absurd direction!
Bubbles bear no introspection. -Khushhal Khan Khatak
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php