No no and no.. Dont go for that approach..
This is what i did.. and it kinda is exactly the same as this tutorial http://www.spoono.com/tutorials/php/users_online/ ..
Now from that tutorial.. You need specific things..
What i used the one i made for was with a forum that is still in progress so i used sessions,cookies to work it out..
So we gonna need to get a timestamp..
so i use time();
So we will varify the time.. Cos the way you are doing it will never decrease but increase even if theres noone on the site
Ok
so
$time=time();
$timeout=$time-300;//300 is seconds so its 5mins..
//then well insert the new person into the database..
well get there IP so we can varify later how many people are online.. (This is good if you dont have sessions or cookies..)
mysql_query("INSERT INTO users_online(id,time,ip) VALUES('NULL','$time','$REMOTE_ADDR')");
//that just inserts to the db.. now to get the users_online
$result=mysql_query("SELECT DISTINCT ip FROM users_online");
$num=mysql_num_rows($result);
//display results
//from there we wont to delete users past the $timeout.. so we do this
mysql_query("DELETE FROM users_online WHERE time < $timeout");
//that deletes rows that are more than 5mins old..
Now i just wrote that in 10mins i think.. So its not a really hard script.. But you came from the wrong direction.. So thats maybe why you didnt know what to do..