[ic] Mysql - autoincrement primary number

Alma Nuker interchange-users@interchange.redhat.com
Tue Mar 12 23:20:01 2002


Thanks Jonathan for your response.

> 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.

>Don't set the field in your form. Setting an auto increment field
causes
>your value to be used instead. For the increment to work, the field
should
>be null.

I remove it from form and then I got following message in error log:

"No key 'my_id' found for function='insert' table='mydb'


I tried to to do following:

<INPUT TYPE="hidden" NAME="my_id" VALUE="">

same thing is happening, I tried following:

<INPUT TYPE="hidden" NAME="my_id" VALUE="NULL">

Then there is no errors in my log file but only thing that gets saved to
db is my_id everything else is ignored.

Here is part of my form:
[set mv_data_enable]1[/set]
[tag flag write]mydb[/tag]
<FORM ACTION="[process]" METHOD="POST">
<INPUT TYPE=HIDDEN NAME="mv_data_table"    VALUE="mydb">
<INPUT TYPE=HIDDEN NAME="mv_data_key"      VALUE="my_id">
<INPUT TYPE=HIDDEN NAME="mv_data_function" VALUE="insert">
<INPUT TYPE=HIDDEN NAME="mv_nextpage" VALUE=@@MV_PAGE@@>
<INPUT TYPE=hidden NAME=mv_check VALUE=NewWeb>
<INPUT TYPE="HIDDEN" NAME="mv_data_fields" VALUE="my_id, ............">

<<<<<<Other fileds go in here >>>>>>>>>>

<INPUT TYPE=hidden NAME="mv_todo" VALUE="set">
<INPUT TYPE="SUBMIT" VALUE="Send Info">