[ic] Mysql - autoincrement primary number

Alma Nuker interchange-users@interchange.redhat.com
Tue Mar 12 18:44:01 2002


Hi list;

I am trying to set  mysql db table, and I want primary key to be
autincremented every time when I add new record to db table.

I have following in my db.mysql

Database  mydb  ymydb.txt __SQLDSN__
ifdef SQLUSER
Database  mydb  USER         __SQLUSER__
endif
ifdef SQLPASS
Database  mydb  PASS         __SQLPASS__
endif
Database  mydb  COLUMN_DEF   "my_id=INT(9) UNSIGNED AUTO_INCREMENT
PRIMARY KEY"
some other fileds etc here ...........

Problem is how to refer to this autoincrement number from my form. I
tried couple different things but did not have any luck.

eg. <INPUT TYPE=HIDDEN name=my_id value="[my-id increment]"> etc. In all
of the cases that I tried my_id gets incremented and stored in db, but
apart form that, everything else is ignored.

If I replace my_id value in form with fixed value for example 1,  then
it gets stored in db together with all other fields that should be
stored in db.

Any help would be highly appricaited.

I had a look trough mailing list but I couldn't find anything that would
help me. I know also that I could use counter instead autonumber but
I would like to use autonumber if it is possible instead counter thing.

Thank you very much.

Alma