Fabrik Cross database joins

by Pier67   Last Updated October 22, 2017 15:10 PM

I have two separate databases with the same credentials: in db1.table1 there is a column containing filepaths that I need to update with a filename that is stored in db2.table2 and that I can retrieve using an ID from a a Joomla Fabrik form input. The form on submission store an ID to db1.table1 and also run a form php plugin with the following code

$galleryId = '{id_element_name_raw}';

if (!empty($galleryId)) {
   $myDb = JFactory::getDbo();
   $myQuery = "
      UPDATE db1.table1
      SET db1.table1.path =
        CONCAT('/filepath/', db2.tabele2.imgfilename)
      WHERE db2.table2.id = '$galleryId'
";
   $myDb->setQuery($myQuery);
   $myDb->execute();
}

where id_element_name_raw is the ID full element name, galleryID is the image ref number in db2 that user is setting in db1 to make the join. The form is stored in db2 (joomla system db).

This code should set on db1.table1.filepath the filepath build from filename contanined in db1.table1 and retrieved with ID. When I submit the form there isn't any change in filepath column in db1.table1 as I'm expecting.

Any tips to make it work?

Tags : php mysql fabrik


Related Questions


Fabrik calc field and outstanding days

Updated March 30, 2016 08:04 AM

How to call the apply button code

Updated April 01, 2016 08:04 AM

Fabrik and modal size

Updated March 16, 2016 08:04 AM

Fabrik slideshow basics

Updated April 27, 2016 08:04 AM