HI
Joomla 2.5
Fabrik 3.0.6.3
database type: Mysqli
default database connection id: 1
extra database call asam connection id: 2
Using the extra database I created a list from one of its table called "partidas" with an autoincremental number id.
In the same database (extra) I have another table called "estructuras" with the following fields
id ........................................an autoincremental number
partida_id ..............................id from partidas table
cargo ...................................1,2,3,4,5,6,7,8,9,
In this table (estruturas) I need to create 9 registers for every register created by the "partidas form"
let's say we are creating the 23rd register at partidas,
then table estructuras should look like this:
id........partida_id..........cargo
150..........23.....................1
151..........23.....................2
152..........23.....................3
153..........23.....................4
154..........23.....................5
155..........23.....................6
157..........23.....................7
158..........23.....................8
159..........23.....................9
In partidas form I have included the following PHP code, process script: "I try them all"
I also try the following PHP code with all process script
I want to mention that according to the wiki
http://fabrikar.com/wiki/index.php/Form_plugin_php
PHP code to execute on from submission - If no script is selected then the code entered here will be run instead.
It is location in components/com_fabrik/plugins/form/fabrikphp
this file path do no exits in fabrik 3.0.6.3
RESULTS
Register at partidas database table created
NO registers created at estructuras database table
QUESTION
Why fabrik is not saving data into estructuras database table
according to PHP code?
Joomla 2.5
Fabrik 3.0.6.3
database type: Mysqli
default database connection id: 1
extra database call asam connection id: 2
Using the extra database I created a list from one of its table called "partidas" with an autoincremental number id.
In the same database (extra) I have another table called "estructuras" with the following fields
id ........................................an autoincremental number
partida_id ..............................id from partidas table
cargo ...................................1,2,3,4,5,6,7,8,9,
In this table (estruturas) I need to create 9 registers for every register created by the "partidas form"
let's say we are creating the 23rd register at partidas,
then table estructuras should look like this:
id........partida_id..........cargo
150..........23.....................1
151..........23.....................2
152..........23.....................3
153..........23.....................4
154..........23.....................5
155..........23.....................6
157..........23.....................7
158..........23.....................8
159..........23.....................9
In partidas form I have included the following PHP code, process script: "I try them all"
PHP:
// To open a specific database using fabrik 3
$db = FabrikWorker::getDbo(false, 2)
//Return the last id of the table partidas
$db->setQuery("SELECT MAX(id) FROM partidas");
&partidas_last_id = $db->loadResult();
for ($counter = 1; $counter <= 10; $counter += 1) {
$db->setQuery("INSERT INTO estructuras (partida_id, cargo_id) VALUES ('$partidas_last_id', '$counter')");
$db->query();
// Debug sql sentence
if (!$db->query()) {
var_dump($db->getErrorMsg());
var_dump($partida_id);
var_dump($cargo_id);
exit;
}
}
PHP:
//Variables for connecting to your database.
//These variable values come from your hosting account.
$hostname = "asam.db.xxxx.hostxx.com";
$username = "wxw";
$dbname = "asam";
//Connecting to your database
mysql_connect($hostname, $username, $password) OR DIE ("Unable to
connect to database! Please try again later.");
mysql_select_db($dbname);
//Return the last id of the table partidas
$query = "SELECT MAX(id) FROM partidas";
&partidas_last_id = mysql_query($query);
for ($counter = 1; $counter <= 10; $counter += 1) {
// Insert a row of information into the table "estructura"
mysql_query("INSERT INTO estructuras (partida_id, cargo_id) VALUES ('$partidas_last_id', '$counter')")
or die(mysql_error());
}
http://fabrikar.com/wiki/index.php/Form_plugin_php
PHP code to execute on from submission - If no script is selected then the code entered here will be run instead.
It is location in components/com_fabrik/plugins/form/fabrikphp
this file path do no exits in fabrik 3.0.6.3
RESULTS
Register at partidas database table created
NO registers created at estructuras database table
QUESTION
Why fabrik is not saving data into estructuras database table
according to PHP code?