I am writing a script, and I need to query the Matrix DB for some data. What is the proper method for doing this?
So far, I was trying:
require_once $MATRIX_ROOT.'/core/include/init.inc'; require_once $MATRIX_ROOT.'/core/include/mysource.inc'; $db_data = Array(); $db = new MatrixDAL(); $db->getDb(); // Just a test statement $sql = 'SELECT type_code FROM sq_ast_typ'; $rows = $db->executeSqlAssoc($sql); foreach ($rows as $row) { $db_data[$row['type_code']] = $row; } print_r($db_data);
Error:
[01-Jul-2010 09:16:58] PHP Fatal error: Cannot call private DAL::__construct() in /home/websites/mysource_matrix/core/lib/MatrixDAL/MatrixDAL.inc on line 55
Obviously I can't do that. So, what it the correct way?