This topic is locked

Auto Increments for 2 tables not working

2/3/2008 1:29:38 AM
PHPRunner General questions
A
asidu author

I have created 2 separate tables by PHPrunner with auto increment for the first field.
1 Class -

StudentID - Autoincrement

Subject - VAR
2 Teacher -

TeacherID - Autoincrement

Subject - Var
I am able to add records automatically for one of the table.

However for the second table I get the following error.
<<< Record was NOT added >>>



Duplicate entry '0' for key 1

It seems like that PHP auto increment does not work for 2 table in the same database.

Is there a resolve to the issue ?
I have tried some tweaks but with out much avail.
Thank you in advance.

A
alang 2/3/2008

Make sure the ID field is not checked for Add or Edit on the "choose fields" tab. It does work fine for as many tables as you like. Virtually all my tables have an autoincrement primary key field.

W
wb3v 2/3/2008

Make sure your id field is and "int" field and not "varchar"

A
asidu author 2/4/2008

Thanks AllanG and Wb3v for your time.

I did accordingly. But still had the problem initially.
I decided to drop off the old tables and recreate them observing your recommendations.
Glad that finally the auto increment works fine for me.
Regards