<?xml version="1.0"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>MachForm Community Forums Topic: Add form data to second database</title>
<link>https://www.machform.com/forums/</link>
<description>MachForm Community Forums Topic: Add form data to second database</description>
<language>en</language>
<pubDate>Sun, 03 May 2026 20:41:53 +0000</pubDate>

<item>
<title>yuniar on "Add form data to second database"</title>
<link>https://www.machform.com/forums/topic/add-form-data-to-second-database#post-16322</link>
<pubDate>Mon, 29 Oct 2012 18:46:36 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">16322@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Hi Roy,&#60;/p&#62;
&#60;p&#62;It is possible to do this, but you will need to know some PHP to be familiar with the modifications. &#60;/p&#62;
&#60;p&#62;The easiest way to do this is to add privileges to your current machform mysql user to be able accessing the other database.&#60;br /&#62;
So that the mysql user is having permission to access your machform database and the other database.&#60;/p&#62;
&#60;p&#62;Once the privileges being set, you can edit your &#34;includes/post-functions.php&#34; file. Search around line 2393 for this code:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;if($process_result[&#38;#39;status&#38;#39;] === true){&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;right exactly below that line, you can add the custom code to do the insert into another database. The code would be something like this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;mf_do_query(&#38;quot;use myotherdb&#38;quot;,array(),$dbh);

$query = &#38;quot;insert into test_table(mytext) values(?)&#38;quot;;
$params = array($table_data[&#38;#39;element_1&#38;#39;]);
mf_do_query($query,$params,$dbh);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;in the above sample code, the other database name is &#34;myotherdb&#34; and the table name is &#34;test_table&#34;.&#60;br /&#62;
All your form data is available through &#60;strong&#62;$table_data&#60;/strong&#62; variable, which is an array.
&#60;/p&#62;</description>
</item>
<item>
<title>ROYW1000 on "Add form data to second database"</title>
<link>https://www.machform.com/forums/topic/add-form-data-to-second-database#post-16321</link>
<pubDate>Mon, 29 Oct 2012 17:08:51 +0000</pubDate>
<dc:creator>ROYW1000</dc:creator>
<guid isPermaLink="false">16321@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Hi&#60;/p&#62;
&#60;p&#62;Does anyone know if this is possible?&#60;/p&#62;
&#60;p&#62;Also has anyone ever attached a HTML Editor to the form?&#60;/p&#62;
&#60;p&#62;Thanks&#60;br /&#62;
Roy
&#60;/p&#62;</description>
</item>
<item>
<title>ROYW1000 on "Add form data to second database"</title>
<link>https://www.machform.com/forums/topic/add-form-data-to-second-database#post-16290</link>
<pubDate>Thu, 25 Oct 2012 12:28:53 +0000</pubDate>
<dc:creator>ROYW1000</dc:creator>
<guid isPermaLink="false">16290@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Hi&#60;/p&#62;
&#60;p&#62;Is it possible when someone completes a form that machform stores it as usual but some of the elements are transferred to a different database with different column names.&#60;/p&#62;
&#60;p&#62;If this is possible can you supply some code and let me know where to put it.&#60;/p&#62;
&#60;p&#62;Thanks in advance&#60;/p&#62;
&#60;p&#62;Roy
&#60;/p&#62;</description>
</item>

</channel>
</rss>
