I think I'm kinda stuck at a trivial point.
I have an html file that I am making ajax requests out to a php file. I would like to have that php file query the modx db for what I am looking for, and return the results as I need (format etc).
This is what I have so far - using
this API page as reference.
file.php
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize( 'web' );
$output = '';
$result = $modx->db->query( 'SELECT id, name FROM `modx_membergroup_names` ORDER BY name ASC' );
while( $row = $modx->db->getRow( $result ) ) {
$output .= '<br /> ID: ' . $row['id'] . '<br /> Name: ' . $row['name'] . '<br />---------<br />';
}
error_log( $output );
I continue to get "Notice: Undefined property: modX::$db"
I'm not sure where I'm going wrong. Thank you for your help!