Forums

Issue saving to DB

anmm 15 Jul, 2014
I have setup the db using the tool within chronoforms but its not saving the data, the debug info is showing the db call but for some reason it showing it trying to update rather than insert? Is this intentional? Its also looking for a id that obviously does not exist, as nothing has been added?

Any ideas?

ta
Dave


26] => Array
        (
            [DB Save] => Array
                (
                    [Queries] => Array
                        (
                            [0] => UPDATE `XXXX_chronoengine_chronoforms_datatable_controlzapp` AS `Data` SET `Name` = 'gfwer', `Organisation` = 'thunder', `Email` = 'dasd@Asd.com', `Telephone` = '1234123123', `Address_1` = '2345', `Address_2` = '2345', `CityTown` = '2345', `PostcodeZIPcode` = '2345', `Country` = '2345', `productinfo` = 'yes', `button13` = 'Submit', `user_id` = '42', `modified` = '2014-07-15 07:33:42' WHERE `id` = '501';
                        )

                )

        )

GreyHead 15 Jul, 2014
Hi anm,

There is an 'id' set in the query which is probably coming from the page URL if the form 'id' in an article.

Please check that the form saves correctly if you use the View Form link from the Forms Manager; if it does then you need either (a) to use a Custom Code action to unset the id value before the DB Save or (b) to rename the id column in the database table to say cf_id.

Bob
simplelogic 17 Jul, 2014
Tried option (a) and (b) of the above both does not seems to resolve my DB save issue via article.
Issue detailes in this post:
http://www.chronoengine.com/forums/posts/t96969/p333463.html#p333463
simplelogic 17 Jul, 2014
Problem resolved. Answering my own question.
Solution:
Drag a Custom Code just before DBSave and remove label. Copy the below in Code section.
<?php $form->data[id]=NULL; ?>
Save and close and then save form. It works now.

Somehow it does not like having both options. GreyHead has an OR in the options.
so when i changed id to cf_id AND null-ed the id it still had issues.

Left the db column name as it is to "id" and added the above custom code it started working.

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