Order [event] => submit [Itemid] => 117 [option] => com_content [view] => article [id] => 5 [fname] => test [lname] => test [address] => address test [postal] => 00111 [country] => USA [mobile] => 123789 [email] => a@a.com [paypal] => [item1] => [qty1] => [item2] => [qty2] => [item3] => [qty3] => [item4] => [qty4] => [item5] => [qty5] => [item6] => [qty6] => [item7] => [qty7] => [item8] => [qty8] => [item9] => [qty9] => [item10] => [qty10] => [submit99] => Submit)Array()ErrorsArray()Debug InfoArray()Thank you for your Help !"> DB cannot be Saved ! ? - Forums

Forums

DB cannot be Saved ! ?

tennycskms 28 Jun, 2014
Hi, I'm using Chronoforms V5 with joomla 2.5.19. I have a form that need save into database, but DB cannot be Saved ! ?

I add a "debugger" action before "db save" , and get the result ......I also check the phpmyadmin and confirm the database has been created.

Data Array
Array
(
[chronoform] => Order
[event] => submit
[Itemid] => 117
[option] => com_content
[view] => article
[id] => 5
[fname] => test
[lname] => test
[address] => address test
[postal] => 00111
[country] => USA
[mobile] => 123789
[email] => a@a.com
[paypal] =>
[item1] =>
[qty1] =>
[item2] =>
[qty2] =>
[item3] =>
[qty3] =>
[item4] =>
[qty4] =>
[item5] =>
[qty5] =>
[item6] =>
[qty6] =>
[item7] =>
[qty7] =>
[item8] =>
[qty8] =>
[item9] =>
[qty9] =>
[item10] =>
[qty10] =>
[submit99] => Submit
)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
)

Thank you for your Help !
GreyHead 29 Jun, 2014
Hi tennycskms,

The problem may be that you have that id=5 entry from the article in the data.

Will the form save if you use the View Form link in the Forms Manager?

What do you see with the Debugger *after* the DB Save action?

Bob
tennycskms 29 Jun, 2014
HI Bob ,

Thanks For Your Great Support !

The problem may be that I have that id=5 entry from the article in the data.
The form can be saved if I use the View Form link in the Forms Manager. I use the FORM in the Module .
you see with the Debugger *after* the DB Save action as follow :

Data Array
Array
(
[chronoform] => Order
[event] => submit
[Itemid] => 117
[option] => com_content
[view] => article
[id] => 5
[fname] =>
[lname] =>
[address] =>
[postal] =>
[country] =>
[mobile] =>
[email] => test@test.com
Y [paypal] =>
[item1] =>
[qty1] =>
[item2] =>
[qty2] =>
[item3] =>
[qty3] =>
[item4] =>
[qty4] =>
[item5] =>
[qty5] =>
[item6] =>
[qty6] =>
[item7] =>
[qty7] =>
[item8] =>
[qty8] =>
[item9] =>
[qty9] =>
[item10] =>
[qty10] =>
[submit99] => Submit

)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
[3] => Array
(
[DB Save] => Array
(
[Queries] => Array
(
[0] => UPDATE `ten_chronoengine_Order2` AS `data` SET `fname` = '', `lname` = '', `address` = '', `postal` = '', `country` = '', `mobile` = '', `email` = 'test@test.com', `paypal` = '', `item1` = '', `qty1` = '', `item2` = '', `qty2` = '', `item3` = '', `qty3` = '', `item4` = '', `qty4` = '', `item5` = '', `qty5` = '', `item6` = '', `qty6` = '', `item7` = '', `qty7` = '', `item8` = '', `qty8` = '', `item9` = '', `qty9` = '', `item10` = '', `qty10` = '', `submit99` = 'Submit', `user_id` = '0', `modified` = '2014-06-29 13:57:20' WHERE `id` = '5';
)

)

)

How Can I solve that problem if I use the form in the Module ?
GreyHead 29 Jun, 2014
Hi tennycskms,

There are two ways to fix it:

a) edit the database table to change the name of the id column to something different e.g. cf_id That's probably the simplest and best provided that the table was created by ChronoForms and isn't used anywhere else on your site. **Do Not** change the column names of any of the main Joomla! tables !!

b) Add a Custom code action before the DB Save with some code to remove the troublesome id entry.
<?php
if (isset($form->data['view']) && $form->data['view'] == 'article' && isset($form->data['id']) ) {
  unset($form->data['id']);
}
?>
The code tries to check that this is really an article ID before removing it.

Bob
tennycskms 30 Jun, 2014
Hi Bob,

When I add Custom Code ...and try again...

Parse error: syntax error, unexpected T_NS_SEPARATOR, expecting T_STRING in //public_html/test.com/administrator/components/com_chronoforms5/chronoforms/actions/custom_code/custom_code.php(20) : eval()'d code on line 2

I check the custom code again and find " / " auto insert into the CODE

<?php
if (isset($form->data[\'view\']) && $form->data[\'view\'] == \'article\' && isset($form->data[\'id\']) ) {
  unset($form->data[\'id\']);
}
?>


How Can I solve this problem ?
Thanks For Your Great Support !
GreyHead 30 Jun, 2014
Hi tennycskms,

You have the extra \ because your PHP is configured with Magic Quotes on. Please try to change the settings to turn them off. This Joomla 3 doc may help.

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