Forums

How do you get data from multiple tables

bsanker 31 Dec, 2010
If the Joomla database is DB1, how can I connect to DB2? Both databases reside on the same server. Normally when I am working with SQL I would just replace the FROM #__content with FROM DB2.table to get data from the table I need.

Below is the standard solution for a Joomla database. How can I convert this to the second database?
$db =& JFactory::getDBO();
$query = "
SELECT `id`, `title`
FROM `#__content`
WHERE `sectionid` = 1
AND `state` = 1 ;
This topic is locked and no more replies can be posted.