Page 1 of 1

row deleting problem - primary key help

Posted: Tue Feb 15, 2005 10:11 am
by zmurf
I asked here about deleting a row, thanks to u people i found it easy.

But know i have a new problem. my table has an "id"-primary key and autoincrement, when I delete lets say row number 2, the next id after 1 becomes 3.

1- server a-on
2- server b-on <--- delete
3- server c-on

=> 1-server a-on
3-server c-on <----- i want this one to be 2-server c-on
4-server d-on <----- and this one to become 3-server d-on

Posted: Tue Feb 15, 2005 10:19 am
by timvw
now all you need to do is create a form or more forms...

that allow you to select a row... usually a checkbox are a radio button is used for this... and a submit button...

virtually every html tutorial will teach you how to accomplish that.

10x

Posted: Tue Feb 15, 2005 3:19 pm
by zmurf
10x timvw, i solved the problem in my code, but now i need to know how to put those auto increments in order.

Posted: Tue Feb 15, 2005 3:21 pm
by feyd
auto_incremented fields are not supposed to be fiddled with.

yup

Posted: Fri Feb 18, 2005 3:47 am
by zmurf
yes indeed, but look at phpmyadmin, i modified my id from there, so i guess it could be done

Re: yup

Posted: Fri Feb 18, 2005 6:42 am
by John Cartwright
zmurf wrote:yes indeed, but look at phpmyadmin, i modified my id from there, so i guess it could be done
As feyd said, it will become very annoiying and glitchy if you decide to alter your auto_incremented field. There is no reason you should have to anyways. Better off re-thinking your logic.