Hello,
If you want to store each field in its own column, you need to store the fields in your own database or table. The plugin stores all submitted data as a serialized PHP Object. For storing the fields in an external database you will need at least the “Developer” version of the plugin, and edit the “cp_calculatedfieldsf_insert_in_database.php” file to define the insertion queries.
More information in the following link:
http://cff.dwbooster.com/documentation#third-party-database
Best regards.
Thread Starter
mads
(@madstudio)
Thank.
I have the platinum version. I know and use “cp_calculatedfieldsf_insert_in_database.php” but how is query for storing each value in a colum …
Best regards.
Hello,
First, you should create your own database table, for example assuming the table’s name you have created is: my_table, with the columns f1,f2,f3,f4 for storing in them the corresponding fields in the form: fieldname1, fieldname2, fieldname3, and fieldname4
Note, it is relly important you know what columns were defined for storing textual values, and what columns were defined for storing numeric values, because with the text values you should use quotes in the insertion queries.
I’ll assume in my example that you have defined your table with the column f1 as VARCHAR(255)
In this case the insertion query would be:
$field1 = mysqli_escape_string( $db_link, $params[ 'fieldname1' ] );
$field2 = mysqli_escape_string( $db_link, $params[ 'fieldname2' ] );
$field3 = mysqli_escape_string( $db_link, $params[ 'fieldname3' ] );
$field4 = mysqli_escape_string( $db_link, $params[ 'fieldname4' ] );
mysqli_query( $db_link, "INSERT INTO <code>".DATABASE_TABLE."</code> (f1, f2, f3, f4) VALUES ('$field1', $field2, $field3, $field4);" );
Note: The table’s name was entered as the value of DATABASE_TABLE constant at beginning of “/wp-content/plugins/calculated-fields-form/cp_calculatedfieldsf_insert_in_database.php” file.
Best regards.