Hello,
i want to use a external Database to save the data? Who can I do this?
Best Regardings adolfo
i want to use a external Database to save the data? Who can I do this?
Best Regardings adolfo
Hi adolf,
There's a how-to document that covers connecting to a second database here. You'll need to hand-code the save in one of the OnSubmit code boxes - but you can use ChronoForms AutoGenerated code as the basis for this.
Bob
There's a how-to document that covers connecting to a second database here. You'll need to hand-code the save in one of the OnSubmit code boxes - but you can use ChronoForms AutoGenerated code as the basis for this.
Bob
Hi Greyhead,
thank you. But where must i put this code to save the form in another database?
adolf
thank you. But where must i put this code to save the form in another database?
<?php
$options = array(
'host' => 'xxx',
'user' => 'xxx',
'password' => 'xxx',
'database' => 'xxx',
'prefix' = 'xxx',
'select' => true
);
$db2 =& new JDatabaseMySQL($options);
?> adolf
Hi adolf,
You will need to put this plus the code to save the form data into one of the OnSubmit code boxes.
Bob
You will need to put this plus the code to save the form data into one of the OnSubmit code boxes.
Bob
How is the code to save the form?
Can I use the $_POST var?
$db2->setQuery("INSERT INTO table (field1,field2) VALUES ('".$_POST['field1']."', '".$_POST['field2']."') ");
Thank you🙂
Can I use the $_POST var?
$db2->setQuery("INSERT INTO table (field1,field2) VALUES ('".$_POST['field1']."', '".$_POST['field2']."') ");
Thank you🙂
Hi adolf,
Yes, that will do it. Or you could adopt the Table Class based method used by ChronoForms if you want to be a little more flexible.
Bob
Yes, that will do it. Or you could adopt the Table Class based method used by ChronoForms if you want to be a little more flexible.
Bob
hi,
is used the following code but it does not work. Can you help me?
In On Submit code - before sending email:(May contain PHP code with tags)
is used the following code but it does not work. Can you help me?
<?php
$dbserver = "84.165.196.100";
$dbbenutzer = "the_user";
$dbpasswort = "pw";
$dbselected = "db01";
mysql_connect($dbserver,$dbbenutzer,$dbpasswort);
mysql_select_db($dbselected);
mysql_query("INSERT INTO kontakte (vorname,kundenname) VALUES ('".$_POST['vorname']."', '".$_POST['kundenname']."') ");
$options = array(
'host' => '88.165.196.100',
'user' => 'the_user',
'password' => 'pw',
'database' => 'db01',
'prefix' = '',
'select' => true
);
$db2 =& new JDatabaseMySQL($options);
$db2->setQuery("INSERT INTO kontakte (vorname,kundenname) VALUES ('".$_POST['vorname']."', '".$_POST['kundenname']."') ");
?>In On Submit code - before sending email:(May contain PHP code with tags)
Hi adolf,
Exactly what is not working?
I'd suggest that you echo out the queries and check them with PHPMyAdmin.
You have got different IP addresses for the server in the two database connections. Is this correct?
Bob
Exactly what is not working?
I'd suggest that you echo out the queries and check them with PHPMyAdmin.
You have got different IP addresses for the server in the two database connections. Is this correct?
Bob
Hello,
the first bug was a lost > after prefix.
If I add a "echo 'test';" at the second line i didnt can see it.
the first bug was a lost > after prefix.
<?php
$options = array(
'host' => '88.165.196.100',
'user' => 'the_user',
'password' => 'pw',
'database' => 'db01',
'prefix' => '',
'select' => true
);
$db2 =& new JDatabaseMySQL($options);
$db2->setQuery("INSERT INTO kontakte (vorname,kundenname) VALUES ('".$_POST['vorname']."', '".$_POST['kundenname']."') ");
?>If I add a "echo 'test';" at the second line i didnt can see it.
hi,
there must be an another bug. It doenst work.
Can i check the connection? Or make a test echo?
there must be an another bug. It doenst work.
Can i check the connection? Or make a test echo?
This topic is locked and no more replies can be posted.
