Buy Now
Sign in

New Field not saving to DB

omidhz , November 29 2018
Answered
O
omidhz
I have a form that saves or updates all the data to a database and it is working as it should.
I decided to add two more fields to the form called "wst" and "wst_unit", and I coded it just like other fields. Then I added two columns to the database via phpMyAdmin with the same names and format.
However, my form is NOT SAVING those two new fields to the database, even though the debugger shows it is saving it correctly. When I look at my debugger information, I don't see it listed where it suppose to save to the database.
I'm not sure what am I doing wrong.
See below:
Array​
​(​
​ [chronoform] => demographics​
​ [event] => submit​
​ [activity] => 1.3​
​ [ethnicity] => caucasian​
​ [wt] => 222.00​
​ [wt_unit] => 1​
​ [ht] => 77.00​
​ [ht_unit] => 1​
​ [wst] => 36​
​ [wst_unit] => 1​
​ [button] => ​
​ [cadc1bee9ebcbe83759a5448896141ea] => db907de6a339a1fb0a54fa254a7be221​
​ [joomla_user_state] => logged_in​
​ [format] => html​
​ [Itemid] => 177​
​ [option] => com_chronoforms6​
​ [view] => form​
​)​
​Array​
​(​
​ [validate_fields3] => Array​
​ (​
​ [log] => Automatic validation enabled.​
​ [var] => 1​
​ )​
​​
​ [save_data10] => Array​
​ (​
​ [data] => Array​
​ (​
​ [chronoform] => demographics​
​ [event] => submit​
​ [activity] => 1.3​
​ [ethnicity] => caucasian​
​ [wt] => 222.00​
​ [wt_unit] => 1​
​ [ht] => 77.00​
​ [ht_unit] => 1​
​ [wst] => 36​
​ [wst_unit] => 1​
​ [button] => ​
​ [cadc1bee9ebcbe83759a5448896141ea] => db907de6a339a1fb0a54fa254a7be221​
​ [joomla_user_state] => logged_in​
​ [format] => html​
​ [Itemid] => 177​
​ [option] => com_chronoforms6​
​ [view] => form​
​ [modified] => 2018-11-29 22:24:35​
​ )​
​​
​ [_success] => Data saved successfully​
​ [log] => Array​
​ (​
​ [0] => UPDATE `response` AS `Data10` SET `activity` = '1.3', `ethnicity` = 'caucasian', `wt` = '222.00', `wt_unit` = '1', `ht` = '77.00', `ht_unit` = '1', `modified` = '2018-11-29 22:24:35' WHERE `user_ID` = '846';​
​ )​
​​
​ [var] => Array​
​ (​
​ [activity] => 1.3​
​ [ethnicity] => caucasian​
​ [wt] => 222.00​
​ [wt_unit] => 1​
​ [ht] => 77.00​
​ [ht_unit] => 1​
​ [modified] => 2018-11-29 22:24:35​
​ )​
​​
​ )​
​​
​)
healyhatman
Clear the cohronoforms cache and try again
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

DON'T COPY+PASTE FROM THE FORUMS! It adds hidden code-breaking format characters!
O
omidhz
I already tried that twice. Still same result
O
omidhz
I was able to fix this, but I have no idea how it got fixed..!.
Here is what I did.
I created a new dummy form to retrieve and save just the wst field into the same data. The new form gave me MySql error #1064.!
Then I deleted the two columns that I previously made in phpMyAdmin from my database via phpMyAdmin.
Then I went to Chronoforms 6 and modified the database by adding the columns there. That fixed everything.
I've had this problem before that when I created a column via phpMyAdmin I was getting error messages, but when I added the columns via Chronoforms database tool, it worked fine. Is there something I'm doing wrong or is this related to how the form is linked to the database??!!
healyhatman
I think the cache is not actually deleted when you tell it to delete the cache. Or something I don't know it shits me
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman

DON'T COPY+PASTE FROM THE FORUMS! It adds hidden code-breaking format characters!
O
omidhz
You may be right. Every time I click on Clear Cache, I get the message that 0 cache was deleted.!
Where does the cache get saved? Maybe I can see if it actually deleting anything.. 
O
omidhz
I found this file:
root: cache/myDatabaseName.db_tables_info.cache.php
It contains the cache related to my form database. I did delete the data manually and saved the file and my forms continued to work fine and after I processed the form, it recreated the cache.
When I clicked on Clear Cache in the Chronoform application, the cache information remained intact. I guess this could be the issue.
O
omidhz
I was able to reproduce the problem.
After I deleted the cache data manually, my form saved the new field to the database. This is clearly a bug in chornoform 6.
S
skittle
I experienced the same issue and agree that this a bug in CFv6. First, I tried refreshing the cache using the option in CF without success. Then, I tried deleting the cache file as suggested in this thread but this did not solve the problem for me either.
I was able to resolve this by switching the Save to database toggle (for the field not saving to the DB) to off, then saving the Chronoform. Next I opened the Chronoform again and switched the Save to database toggle back on and saved the Chronoform. This worked. While the cache may be a part of the problem here, it seems like the Save field to database option is not being save or updated as expected.
John