RE: [PHP] Adjusting Indexed Field After Deleting Entry
| From: | Jon Haworth | Date: | Mon, 27 Jan 2003 10:17:20 +0000 |
| Subject: | RE: [PHP] Adjusting Indexed Field After Deleting Entry | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-133230@lists.php.net to get a copy of this message | ||
Hi,
> I originally had a link #1, #2, and #3. I obviously deleted them.
> I was wondering if there is a way to use PHP/MySQL to get the
> indexed numbers to re-assign so that the first link you see is
> always #1 the second link you see is always #2 and so on?
(apologies for previous incomplete message - pressed Ctrl+Enter by mistake
:-)
If these are the primary keys in your database, you can reset the
auto_increment with this query:
ALTER TABLE tablename AUTO_INCREMENT = 1;
Or set it to whatever you like:
ALTER TABLE tablename AUTO_INCREMENT = 23;
Cheers
Jon