<![CDATA[ [Snippet] eForm2db 0.1BETA - Manipulate DB records via eForm and MODx DBAPI - My Forums]]> https://forums.modx.com/thread/?thread=35711 <![CDATA[Re: [Snippet] eForm2db 0.1BETA - Manipulate DB records via eForm and MODx DBAPI]]> https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-542746 The only issue I have is when I click on the module I see [+name+] and [+comment+] and the link also isn't "parsed" db=[+recID+].

Anyone got a clue whats wrong?

Everything besides that works (saving fields in the DB)]]>
fourroses666 Jun 24, 2016, 04:57 AM https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-542746
<![CDATA[Re: [Snippet] eForm2db 0.1BETA - Manipulate DB records via eForm and MODx DBAPI]]> https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-538404
The issue I had was Creating the DB.
It did work when creating it like this:

CREATE TABLE `my-db-table` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(255) NOT NULL,
  `adres` varchar(255) NOT NULL,
  `phone` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
);



ENGINE=MyISAM DEFAULT
and ENGINE=INNODB DEFAULT gave an error.]]>
fourroses666 Feb 17, 2016, 04:52 AM https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-538404
<![CDATA[Re: [Snippet] eForm2db 0.1BETA - Manipulate DB records via eForm and MODx DBAPI]]> https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-537287 timur.gilauri Jan 21, 2016, 04:51 AM https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-537287 <![CDATA[Re: [Snippet] eForm2db 0.1BETA - Manipulate DB records via eForm and MODx DBAPI]]> https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-508318 Following the steps on on modx wiki:http://wiki.modxcms.com/index.php/Use_eForm_to_Store_data_into_Database do the following:
first
we will change this step by adding UNIQUE in the fields we don't want to be duplicated. For instance, if we have an email field do this:
CREATE TABLE `cargas` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `email` varchar(255) NOT NULL UNIQUE,
  PRIMARY KEY  (`id`)
);


second
This step can remain the same as it is described in the modx wiki.

third
We need to change the part of our snippet where we run the db insert query(we change the
$dbQuery = $modx->db->insert($dbTable, 'cargas' );
in order to run an INSERT IGNORE query. This way duplicate entries will be ignored on UNIQUE fields).

<?php
function agregarCargas( &$fields )
    {
    global $modx;
    $dbTable = array();
    $dbTable['email'] = $modx->db->escape($fields['email']);
    $usermail=$dbTable['email'];
    $result = $modx->db->query("INSERT IGNORE INTO modx_cargas(email)
    VALUES('$usermail')");
    return true;
    }
?>


Remember that you can have only one primary key but as many UNIQUE fields as you want. And if you don't want the "This form was already submitted succesfully. There is no need to submit your information multiple times." message to appear then add this to your snippet call:
&protectSubmit=`0`
Otherwise you can leave the corresponding messages blank in assets/snippets/eform/lang/YOUR_LANG.inc.php to get rid of unwanted messages. That's what i did for the thank you message, but keep in mind that will make the messages not to appear in all eform calls so choose wisely.]]>
dinpapa Sep 08, 2014, 03:25 PM https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-508318
<![CDATA[Re: [Snippet] eForm2db 0.1BETA - Manipulate DB records via eForm and MODx DBAPI]]> https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-196883 first, I found the wiki article which I edited to fit my needs.
The form to input the data showed well, but after submitting the data it did nothing, just showed again the start page and, of course, no data was inserted to the table.
I then copied exactly the code in the example. no luck, same behavior. And no mather what I put as debugging info in my function, it was as if it was never run.
after hours reading the forum and trying every solution I didn’t know where to search.
looking at the source code in the page where I had the formin the form tag, it sayed:
<form action="es/nuevo-tema.html".............

yes, I use friendly urls.
but every other link created by wayfinder, started with a "/"
/es/Bienvenido.html
etc..........

so I added a / in my form action:
<form action="/[~[*id*]~]"..................

and this did the trick.
I don’t know exactly why but if you are as lost as I was, you may try it...
Regards Abner
Magic Creations
]]>
Magic Creations Feb 20, 2011, 12:26 PM https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-196883
<![CDATA[Re: [Snippet] eForm2db 0.1BETA - Manipulate DB records via eForm and MODx DBAPI]]> https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-196882 http://wiki.modxcms.com/index.php/EForm_to_CSV

will try this if i have a go]]>
fourroses666 Jan 13, 2011, 05:18 PM https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-196882
<![CDATA[Re: [Snippet] eForm2db 0.1BETA - Manipulate DB records via eForm and MODx DBAPI]]> https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-196881 Quote from: cipa at Jan 13, 2011, 02:17 AM

What do you mean by "receive the db saved fields"?

I don’t have the knowledge to script this myself, i have no db and php skills.
Offcourse i can choose to download the csv with phpmyadmin, but i rather have a link on a secured page where my client can download the csv file (with all entered fields listed).

So wondered if this snippet had it of if there was already made a snippet for it.


Dunno if Sottwell solution can be done without scripting? create a manager module? shocked]]>
fourroses666 Jan 13, 2011, 03:10 AM https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-196881
<![CDATA[Re: [Snippet] eForm2db 0.1BETA - Manipulate DB records via eForm and MODx DBAPI]]> https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-196880
You could use the eFormOnBeforeMailSent event to format the data into .csv or .sql files, then attach the file to the report email.

You could create a secured front-end page with a snippet to retrieve the data and either display or generate the .csv or .sql file for download.]]>
sottwell Jan 12, 2011, 11:36 PM https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-196880
<![CDATA[Re: [Snippet] eForm2db 0.1BETA - Manipulate DB records via eForm and MODx DBAPI]]> https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-196879 cipa Jan 12, 2011, 08:17 PM https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-196879 <![CDATA[Re: [Snippet] eForm2db 0.1BETA - Manipulate DB records via eForm and MODx DBAPI]]> https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-196878 anyone did this? without using phpmyadmin to dl the db?]]> fourroses666 Jan 12, 2011, 03:11 PM https://forums.modx.com/thread/35711/snippet-eform2db-0-1beta---manipulate-db-records-via-eform-and-modx-dbapi?page=23#dis-post-196878