I have two Joomla sites with different databases. I want to share all data from one site to another site. For example, when I register a user in one website then it's updated on the second site's database too.
I have this code to connect the external database, but I am new to Joomla so don't know how to implement it.
<?php
$db = JFactory::getDbo();
$option = array(); //prevent problems
$option['driver'] = 'mysql'; // Database driver name
$option['host'] = 'db.myhost.com'; // Database host name
$option['user'] = 'fredbloggs'; // User for database authentication
$option['password'] = 's9(39s£h[%dkFd'; // Password for database authentication
$option['database'] = 'bigdatabase'; // Database name
$option['prefix'] = 'abc_'; // Database prefix (may be empty)
$db = JDatabaseDriver::getInstance( $option );
?>