Forums

Write to 2 database tables

OHmichelle 15 Jan, 2010
I have my DB connectivity enabled, and I'm writing to 2 tables.

When I originally set up my form, I was only writing to 1 table and it worked fine. When I add the 2nd table, no matter what I do, I can't get the write to the 2nd table to work properly.

I have tried 2 approaches to get this to work.
1 - I've added php sql query code to write to the 2nd table after the email is sent. This works okay EXCEPT I get a "Warning: implode() [function.implode]: Invalid arguments passed" error after I hit the 'submit' button If it wasn't for the error message this would be a good solution.

2 - I remove the php sql query code, add a hidden field to my form with the exact name of the field in the 2nd table with the input value I want. This gives this error: "store failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use" I am using 2 hidden fields that write to the 1st (original) table and everything works fine.

Does anyone have suggestions on how I can get this issue resolved?

Thanks.
GreyHead 15 Jan, 2010
Hi OhMichelle,

I'm not sure why the double-table save isn't working.

If you turn Site Debug on briefly and submit the form you should see a long series of MySQL queries including - hopefully - the one that is failing. Can you pull that out and take a look to see what seems to be wrong with it?

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