PDA

View Full Version : too many primary keys error


drbobtampa
05-03-2009, 01:14 PM
I am just starting with phpmagic. I am accessing an existing db with existing tables. I used the utility to generate the project file on the server and downloaded the project and can access it with phpmagic just fine. I see the dp and all the tables. In addition to five data tables related to the forms (ap_form_1 and ap_form2, etc) there are 4 other tables ap_column_preferences, ap_element_options, ap_form_elements, and ap_forms. When I attempt to create the phpcode, I get the following error:

Table 'ap_form_elements' has too many primary keys. Only one primary key is allowed per table.

See attached for image of the elements for this table.

Please advise. I am NOT an expert on databases and and figuring things out slowly. These tables are generated and accessed by a php form generating and editing program called machform if that helps.

Thanks,

Bob

xacto
05-03-2009, 02:49 PM
element_id in this table seems to be defined as a pk and maybe this field should be a foreign key instead. See what other table has this field. Within PHPMagic select this field in the 'ap_form_elements' table and uncheck primary key. I'm not sure what the datatype should be since I do not know what type of data this (element_id) field contains. text,integer etc. In the tab's select Lookup and set the proper realtion for the field. Take a look in the help -> contents -> Working with projects > Understanding relationships it may help you solve the isssue. :D cheers

drbobtampa
05-03-2009, 03:46 PM
Thanks! :)
Bob