Page 1 of 1

mysql userID problem

Posted: Thu Feb 10, 2005 1:34 am
by pleigh
if i have a users table like below:
userID name
1 apple
2 banana
3 cherry
4 durian
5 earrth
6 farm
7 gooseberry
8 hogplum
9 indian mango
10 jackfuirt
when i tried to delete one row, let's say, userID 1, name apple, then i tried to refresh the database, the 2nd name, banana bacame the first in the list with the userID still 2, like below:
userID name
2 banana
3 cherry
4 durian
5 earrth
6 farm
7 gooseberry
8 hogplum
9 indian mango
10 jackfuirt
instead of banana being the userID # 2, i want it to be # 1 since the apple is deleted. is there any way i can do it?also, when i tried to reboot the computer, this is still the case.i already set the userID to auto_increment.

thanks in advance.

pleigh[/list]

Posted: Thu Feb 10, 2005 1:50 am
by feyd
you have to manually update all records that appear after that id number. Then update the table's auto_increment value to the new maximum.

However, auto_incremented fields are not supposed to be used for counting. That's what COUNT() and mysql_num_rows() are for..