row missing in an auto-increment field of DB table

anilson1

New Member
Messages
45
Reaction score
0
Points
0
Hi,
I have a table in my database with a auto-increment field. while I was creating the php script I deleted a couple of rows. Now the index of this rows are missing on the table. when I try to insert a new row it doesn't start from the one displayed but from the last one created. for exemple;
I had:
row 1
row 2
row 3 (deleted)
row 4 (deleted)

I want to creat new rows including row 3 and row 4. but instead I get:
row 1
row 2
row 5
row 6

what can I do to get back the rows 3 and 4?
 

oracle

New Member
Messages
430
Reaction score
0
Points
0
You can go back to operation and set back the auto-increment field to 3 which must be 5 by now.

Or you can use standard sql query to set that to 3.

Also if you hard code it, you shd be able to insert a row with auto incrememt id = 3
 

VPmase

New Member
Messages
914
Reaction score
1
Points
0
You can do this in phpMyAdmin. Go to your table and insert two new rows after row 2. Its really easy once you see it.
I'll post a screenshot.
ffoyouqi3.png
 
Last edited:

oscetips

New Member
Messages
26
Reaction score
0
Points
0
in php:
mysql_query("ALTER TABLE `table_name` AUTO_INCREMENT =new_number_here");

in phpmyadmin, execute this sql query:
ALTER TABLE `table_name` AUTO_INCREMENT =new_number_here;
 
Top