Forums

Saving 2 forms to same table

cjmicro 06 May, 2011
I have 2 forms and would like the data for both connected and saved in the same table. Is this possible? I got an error about a duplicate key... is there some way to get around this? Both forms are identical in what would be submitted, just different form actions at the end.

Thank you,
Cheryl
GreyHead 07 May, 2011
Hi Cheryl,

This should work OK with a normal DB Connection.

The duplicate key message sounds as though you are pre-setting the valeu of the table primary key column - the save then fails when that value already exists in the table.

Bob
cjmicro 07 May, 2011
So what should I do just remove any values in the primary key id?

Turns out they want 2 sep db anyway but would be good to know for future.

Thanks Bob!

Cheryl
GreyHead 07 May, 2011
Hi Cheryl,

Hard to say without seeing the specific of these forms but normally I'd use an auto-incrementing primary key and let MySQL handle all of that. I often also add a random string uid of my own as well that I can use to access records from the front-end without giving away any info about the record structure.

Bob
This topic is locked and no more replies can be posted.