mysql_select_db( 'SHARED_DATABASE_NAME' );
global $dbase; mysql_select_db( $dbase ); // Ensure original DB is selected once done
<?php global $dbase; mysql_select_db( 'modx_shared' ); // Select statement to come... mysql_select_db( $dbase ); return 'hello world'; ?>
« MODx Parse Error » MODx encountered the following error while attempting to parse the requested resource: « Execution of a query to the database failed - Table 'modx_shared.modx_site_templates' doesn't exist »

<?php global $dbase; // mysql_select_db( 'modx_shared' ); // Look what you did, you little jerk // Select statement to come... mysql_select_db( $dbase ); return 'hello world'; ?>
<?php
// ...
function connect($host = '', $dbase = '', $uid = '', $pwd = '', $persist = 0) {
global $modx;
$uid = $uid ? $uid : $this->config['user'];
$pwd = $pwd ? $pwd : $this->config['pass'];
$host = $host ? $host : $this->config['host'];
$dbase = $dbase ? $dbase : $this->config['dbase'];
// ...
?>
(duh)$myQueryResult = $modx->db->select( '*', 'modx_shared.test_table' );
$mydb= new DBAPI('localhost', 'shareddb', 'user', 'pwd');$mydb->select( '*', 'test_table');
Of course, I may be biased and just trying to get some testing assistance on my new object-oriented database access layer. 
What you need is a new instance of the DBAPI class, which maintains it’s own connection to the other mysql database...
$mydb= new DBAPI('localhost', 'shareddb', 'user', 'pwd');
Then call the same functions you would from the $modx->db object.
$mydb->select( '*', 'test_table');
If it’s a bunch of shared data though, you could skip that, and download xPDO from SVN and use it to connect to your other database, get instant object-oriented PHP scaffolding for your tables, and become familiar with the future of MODx and database access, all at the same time.Of course, I may be biased and just trying to get some testing assistance on my new object-oriented database access layer.
I’m preparing xPDO 1.0-beta for download from the xPDO site, hopefully sometime later today, in preparation to start sharing some MODx components and example solutions I’ve been working on via xPDO for the past few months.
The time for me to learn xPDO is now and I’ve love to begin a bit of user testing, etc. Where is the best place (somewhere within the xPDO site, I assume) to start so that I may implement into MODx and begin testing? Any other immediate benefits an xPDO approach may offer?
Thanks for the props. I need some help getting it documented, too, so I hope a few more people start to explore and understand it.
wow. i think i understand xpdo now and it looks amazing. nice work jason.
how stable is the current release (1.0a13)? is it good enough for production use?
keep it up mate