需要查看用户类型的活动会话数

After several years of retirement from PHP development (10+ years), I am resurrecting my very rusty skills and I am trying to get what should be a simple application working.

I have 2 types of users- "A" and "B". The user types are recorded in the data base. I need to see how many of each type of user is online at any particular time (sessions). I would like instant results, but a lag time of a minute or so is acceptable for this application. I am using PHP 5.4 and MySQL 5.5.52.

It would be GREATLY appreciated if answers were as simple and gave as much complete code as possible. I have researched this question on this site, but could not find an answer that worked for me.