That function returns a MySQL result set (a resource). You need to fetch the row from the result set using
$row= $modx->db->getRow($foo);
$count= reset($row);
The row is an associative array...or even easier...
$count= $modx->db->getValue($foo);
which will directly get the value of the first column in the first row returned in a result set.