Forums

Save form data to multiple tables

cachito 31 Aug, 2014
I made a form for updating a users profile. The data are read from two tables: the Joomla User table and a custom chronoforms-table with additional infos of the user. The data is hold under two differnt ModelIDs: User and UserExt.

After submitting the changed data i have two DBSave-Actions, one for the joomla table, one for the custom table.

My Problem: in both tables the data is not updated. After the Save-Action there is one new row in both tables.

What is my error?

Sorry for my bad english :-(

Greetings
Gerhard
cachito 31 Aug, 2014
Thank you calculus00,

but i read these faqs before and haen't find a solution.

Greetings
Gerhard
Max_admin 01 Sep, 2014
1 Likes
Hi Gerhard,

Both models ids should have under them a field with the primary key value of each record, so in case of User, you must have a field named User[id]

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 01 Sep, 2014
Answer
1 Likes
Hi Gerhard,

To update a table you need to make sure that the $form->data array has an entry matching the Primary Key column of the record you want to update.

For a Joomla! table this will normally be $form->data['id']; for a ChronoForms created table it may be $form->data['cf_id']

Bob
cachito 01 Sep, 2014
Thank you Max, thank you Bob,

this was the hint i needed!

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