accessing other database tables within or outside package.

Permalink
This may sound like a dumb question but all the tutorials and explanations / demo etc. loads the database tables with either the package and or block level and then does all the logic within that block with those tables. I have seen a few times where the meta data is accessed ( userID, Username etc. ) But in my coding past ( COLDFUSION , LITTLE PHP ETC.) I WAS ABLE TO ACCESS ANY TABLE WITH THE DATABASE AT ANY LEVEL - IS THIS TRUE WITH CONCRETE 5? Sorry caploock was on - I was just wondering because there are blocks that I would use the database tables for other blocks ( custom ) Just don't know if it's possible.
P.S> before someone answers with the answer - you should include any logic within your package so that people can update or move etc. I do know this I am asking for one of my own sites which I would moderate.

Jim

INTcommunications
 
mkly replied on at Permalink Reply
mkly
Um, I'm not sure I completely understand but this
$db = Loader::db();
while($res = $db->GetRow('SELECT id, firstname, lastname FROM Something WHERE firstname = ?', array('Charles'))) {
  echo '<li>' . $res['lastname'] . '</li>';
}

concrete5 uses the PHP ADODB library( good docs here http://phplens.com/lens/adodb/docs-adodb.htm... ) which basically just loads the database specified in your config/site.php and lets you do whatever you want.

I should add this isn't an accident, this is by design.

Best Regards,
Mike