Posted
This FAQ tells you how to connect to a database other than the default site database.
In ChronoForms v4 the DB Save action has an advanced tab where you set up to save to a remote database, but not to read from one.
First you will need to get the database login paramters and check that it is accessible from the site server. If it is on the same database server this will probably be OK. Check with your web host if you are in doubt.
<?php $options = array(); $options['driver'] = 'mysqli'; // Database driver name $options['host'] = 'xxx'; // Database host name $options['user'] = 'xxx'; // User for database authentication $options['password'] = 'xxx'; // Password for database authentication $options['database'] = 'xxx'; // Database name // $options['prefix'] = ''); // probably not needed $db2 = \JDatabase::getInstance($options); . . . $db2->setQuery($query); $data = $db2->loadObjectList(); . . .
You can then use any of the standard Joomla! database methods (see the Joomla! docs here) .
I've called this connection $db2 just to avoid conflicts if you have a $db connection to the Joomla! database in the same code segment.