Here is an example the MODx way...in a snippet, you’ll want to include the following code... (please note no PHP tags required)
$output= '<ul>' . "\n";
if ($ds= $modx->db->select("*", $modx->getFullTableName('web_users'), "", "username", "")) {
while ($row= $modx->db->getRow($ds)) {
$userId= $row['id'];
$userName= $row['username'];
$output.= "<li><strong>$userId</strong> $userName</li>\n";
}
}
$output.= '</ul>' . "\n";
return $output;
This is using the internal DBAPI and the getFullTableName() function so it will work on any installation, and shares the internal DB connection. Oh and it also sorts by username. Let me know if you have any questions about any of this.