This topic is locked

Autoincrement ID field on Add page

8/10/2006 6:54:57 PM
PHPRunner General questions
jwoker author

I am creating an add page for a table that has an autoincrement ID field. I just want users to enter their name and password and then have the ID field given an autoincremented value. I thought this would happen automatically with add record, but I got an PHP error "Duplicate entry '2' for key 1". My thinking is that I need to make ID a hidden field and give it a default value that represents what the tables autoincrement value would be, but I don't know what to put in the default value window?
Thanks

A
amirgulamali 8/10/2006

your approach seems right but i think you will have to do more than that..

When deisgning your table, make the ID field a PK with an autoincrement property

jwoker author 8/11/2006

More information:
I think the table will autoincrement if it is given a chance. The table i'm adding to is _user, this is the same table that phprunner looks to for login/password. When I use the add page for _user it is filling the ID field with the id number of the user that is logged in and trying to "add new"

Alexey admin 8/11/2006

Hi,

When I use the add page for _user it is filling the ID field with the id number of the user that is logged in



This happens because you set Advanced security - Users can edit their own data only.

When you add a new record the ID of currently logged user is written into the table to mark that the user owns this record.
I recommend you to use Registration page to add new users.