Forums

DB Save from 4 record loader actions

Xorcist 12 Jul, 2011
Hello,

(Using Chronoforms_J1.5_V4_RC1.9 and Joomla! 1.5.23)
I am having a problem with saving info into a db using the DB Save action. I have a form that is populated from 4 tables using 4 different model IDs (Note, City, State, User) and just want the form to write to the db as well as send out an email. I have the record loading portion working fine as well as the email portion. My problem is that when I add a DB Save action I get an error:

Parse error: parse error, expecting `','' or `';'' in C:\xampp2\htdocs\ppr\administrator\components\com_chronoforms\form_actions\db_save\db_save.php(62) : eval()'d code on line 10

Fatal error: Call to a member function bind() on a non-object in C:\xampp2\htdocs\ppr\administrator\components\com_chronoforms\form_actions\db_save\db_save.php on line 85

Here are the settings of my record loader actions:

DB Record Loader 1:
DB Field: id
Table: ppr_properties_products
Request Param: uid
Load Fields: Yes
Model ID: Note
Load Under Model ID: Yes
Where statement: none

DB Record Loader 2:
DB Field: id
Table: ppr_properties_state
Request Param: id
Load Fields: No
Model ID: State
Load Under Model ID: Yes
Where statement: <?php
$detail = $form->data['Note'];
?>
`id` = '<?php echo $detail['sid']; ?>'

DB Record Loader 3:
DB Field: id
Table: ppr_properties_locality
Request Param: id
Load Fields: No
Model ID: City
Load Under Model ID: Yes
Where statement: <?php
$detail = $form->data['Note'];
?>
`id` = '<?php echo $detail['lid']; ?>'

DB Record Loader 4:
DB Field: id
Table: ppr_users
Request Param: id
Load Fields: No
Model ID: User
Load Under Model ID: Yes
Where statement: <?php
$user = &JFactory::getUser();
echo "id = ".$user->id
?>

Any help would be much appreciated.
GreyHead 12 Jul, 2011
Hi Xorcist,

This error usually results from an input/column name with a space, slash, quote or some other special character in it.

Bob
Xorcist 13 Jul, 2011
Hi Greyhead,

Thank you for the response, it really helped. Through process of elimination I narrowed it down to the "[" and "]" in the field names because I am loading under Model id's. If the square brackets are special characters that cannot be in column names and I need the column names to be the same as the field names, how can I load under model id's and save to db without producing a syntax error?

-ed
GreyHead 14 Jul, 2011
Hi Xorcist,

I haven't used Model IDs but I imagine that the column name needs to match the bit inside the quotes and brackets ['[color=#000080]column_name[/color]']

Bob
Xorcist 15 Jul, 2011
Hi Greyhead,

Thanks again for your time/response. The problem was that since the data was loaded under Model IDs it must also be saved under Model IDs or else it will produce a syntax error. I dragged 4 db saves over to the events section and configured each to save under their respective Model ID. That got rid of the sytax error but now each model ID is creating a new row/record and I need all of the form data to write to 1 record, not 4. Any ideas of how to go about this?

-ed
GreyHead 15 Jul, 2011
Hi Xorcist,

Silly question but why are you using mOdel IDs at all it seems that they are causing you more trouble than help.

To get multiple DB Saves to go to the same database record I think that you'd need to get the primary key of the record from the first save and then make sure that this was included in each of the succeeding saves . . . or hand-code the DB Save.

Bob
Xorcist 15 Jul, 2011
Hi Greyhead,

The only reason I chose to go with Model IDs is because I am following the concepts of this post:

http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=26&t=21697

I am new to php so I am using this forum along with the tutorials and your book I purchased to help me get through this struggling/learning period. After applying what I learned from that post, I was finally able to display data from 4 different tables on 1 form. If I do not load under Model IDs, I cannot get the data to load from more than 1 table (noob problem I'm sure). I will try to do what you said and load the data without using the models. I've searched on here for a comparable post both on this forum and in your book but couldn't seem to find anything with examples similar to what I need....Load from 4 tables, write to a 5th table on submit (after email action) . If you are aware of any examples of this could you please post?

Again, I really appreciate your help on this.

-ed
Max_admin 13 Aug, 2011
Hi Xorcist,

This may be too late, you may load the data from the 4 tables with 4 record loaders without the need of Model ids if your table columns and form fields names are unique, otherside you need the Model ids, when you save back you may just use some custom code action to strip the model ids from the post array and save fine.

however you will have to pay attention that when you are creating the table all your fields names should not have any special characeters or brackets, that was the problem you are having, the table created was not good I think.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Xorcist 22 Aug, 2011
Hi Max,

That's exactly the help/guidance I needed. Thank you so much. I will post results when I get it working for others to use.

Awesome component by the way.

Cheers,

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

VPS & Email Hosting 20% discount

{item:title} {images:#}