You know, this idea has been rehashed so many times here it's not funny. :-) The short version is, you can't do exactly what you want, because of the stateless nature of http. What most people do as a substitute is to timestamp every logged-in page load in the user table, and then at periodic intervals (e.g. every 5 minutes) remove everyone who hasn't had a new page load since last time. This gives the count of people who have looked at pages in the last N minutes, but often the designer plays fast and loose and presents it as simple The Count of Users Logged In.
As a side issue, one thing no one has ever bothered to explain is why you would even want to do this. It sure doesn't bother me not to know this information about phpbuilder itself, for example.