Hi,
I want to write out multiple records into a table using a DBSave.
So I created the data in a Model which contains data (in part) as follows:
I have a MySQL table with all the above fields, and so I set it up to save multiple records from the Model "C" as above.
It all works except that the field "[LastName]" does not appear in the INSERT Statement:
I have tried deleting and recreating the table, the field in the DB, and the DBSave (and even the entire form), I have tried moving the [LastName] field to another place in the list of fields in the array, but nothing works. The field is simply treated as if it doesn't exist, while all the others work fine.
This is very strange and I am hoping there is a simple explanation for it.
Cheers
Tim
I want to write out multiple records into a table using a DBSave.
So I created the data in a Model which contains data (in part) as follows:
[C] => Array
(
[0] => Array
(
[attributes] => Array
(
[type] => Contact
[url] => /services/data/v40.0/sobjects/Contact/0039000001o080bAAA
)
[LastName] => Name
[Website__c] => www.mysite.com
[Facebook_Page__c] =>
[Nearest_Town_to_Site__c] => Someplace
[MobilePhone] => xxx
[Mbr_Region__c] => MyState
[Member_Nbr__c] => M-17021
I have a MySQL table with all the above fields, and so I set it up to save multiple records from the Model "C" as above.
It all works except that the field "[LastName]" does not appear in the INSERT Statement:
[DB Save] => Array
(
[Queries] => Array
(
[0] => INSERT INTO `2bi_chronoengine_chronoforms_clublist` (`Website__c`, `Facebook_Page__c`, `Nearest_Town_to_Site__c`, `MobilePhone`, `Mbr_Region__c`, `Member_Nbr__c`, `uniq_id`, `created`) values ('www.mysite.com', '', '', 'xxx', 'MyState', 'M-17021', '17e4f0a13e1f08e7d44ffc10861b13dc31b0c6ea', '2017-08-14 08:52:02');
I have tried deleting and recreating the table, the field in the DB, and the DBSave (and even the entire form), I have tried moving the [LastName] field to another place in the list of fields in the array, but nothing works. The field is simply treated as if it doesn't exist, while all the others work fine.
This is very strange and I am hoping there is a simple explanation for it.
Cheers
Tim
Hi Tim,
Have you tried clicking the Delete Cache icon in the Forms Manager toolbar?
Bob
Have you tried clicking the Delete Cache icon in the Forms Manager toolbar?
Bob
Hi Bob,
Yes, and it made no difference. I got around it in the end by using a JFactory query inside a foreach looking through the array, instead of the DBSave. This worked fine, except for one error as noted below. It's a bit more code but at least it is pretty much guaranteed.
I did discover that one record in the data for the field that wasn't saved contained an embedded quote ( "O'Connor"). I wonder if it is this which threw the DBSave off track?
Tim
Yes, and it made no difference. I got around it in the end by using a JFactory query inside a foreach looking through the array, instead of the DBSave. This worked fine, except for one error as noted below. It's a bit more code but at least it is pretty much guaranteed.
I did discover that one record in the data for the field that wasn't saved contained an embedded quote ( "O'Connor"). I wonder if it is this which threw the DBSave off track?
Tim
This topic is locked and no more replies can be posted.