Its actually like this :
$fiveMinutesAgo = time();
$fiveMinutesAgo -= 60*5;
$workers = mysql_query("SELECT count(*) FROM `stats_userMHashHistory` WHERE `timestamp` >= $fiveMinutesAgo AND `mhashes` > 0");
// Verify it worked
if (!$workers) echo mysql_error();
$nrworkers = mysql_fetch_array($workers);
Then where ever you want to display the amount of workers :
echo "$nrworkers[0]"
Btw the stats_userMHashHistory table is filling up pretty quickly, especially if the number of workers that have been created increases, I think this will be become a scalability bottleneck.