Hi,
SELECT count(profile_id) FROM categories GROUP BY profile_id;
With your select, you'll get a column named "count(profile_id)" back, which can be used in php.
SELECT count(profile_id) as numRows FROM categories GROUP BY profile_id;
With this select, you'll get a column named "numRows" back, which can be also used in php.
If you are using mysql, you can count the rows with mysql_numrows($queryresult).
This was tested in mysql/oracle, but should work elsewhere, too.
So long,
Toni