Closed Thread Icon

Topic awaiting preservation: PHP/MySQL and editing PRIMARY (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12363" title="Pages that link to Topic awaiting preservation: PHP/MySQL and editing PRIMARY (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: PHP/MySQL and editing PRIMARY <span class="small">(Page 1 of 1)</span>\

 
Thumper
Paranoid (IV) Inmate

From: Deeetroit, MI. USA
Insane since: Mar 2002

posted posted 08-13-2002 10:39

I have a PRIMARY KEY of "id" in my MySQL table which is smallINT(2), auto_increment, and NOT NULL.

My problem is being able to UPDATE the id through an HTML form processed under a looping PHP file. The form has the field type TEXT but when I SUBMIT, nothing happens if I've tried to edit the id. The other fields edit just fine though as they are set to VARCHAR(25), NULL, FullText. Any ideas on how I can allow for editing the id?

someoneInverse
Bipolar (III) Inmate

From:
Insane since: May 2002

posted posted 08-13-2002 11:41

as far as Im aware, editing auto-incrementing ID's simply isn't possible

you might want to reconsider the use of an auto-incrementing field - it'll be a pain, but ultimately it'll make your system more flexible

I:.

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 08-13-2002 12:51

I don't see why you couldn't change the auto_incremented field... and the manual doesn't say anything either.

Your problem might be that you're doing something like
"update table set id='$id', text = '$text'... where id='$id'
$id is the changed id that your form passes in.
You'd have to use the original id for the where clause to change the record. (put it in a hidden field on the form maybe.)

is that it?

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 08-13-2002 15:35

See here also:
www.ozoneasylum.com/Forum12/HTML/001016.html

___________________
Emps

FAQs: Emperor

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 08-13-2002 18:24

your problem is more likely with your primary key, primary key's must be unique attributes if you are trying to set a value in a colume set to primary to an existing value you are gonna be hosed.



.:[ Never resist a perfect moment ]:.

« BackwardsOnwards »

Show Forum Drop Down Menu