mikenl Posted April 27, 2007 Share Posted April 27, 2007 Hey, I need to show who's online on a site. I have a table with personal data. Should I make a new table with online data or will adding a timeout field to the existing table be able to carry the load of an update of that field every 1 minute or so? Please advise if you have experience with this? There's 25.000 rows in the table and I expect up to 500 people to be online at a time, but would like if 4000 online could work too, load wise... THX Link to comment https://forums.phpfreaks.com/topic/48891-got-advice-on-whos-online-phpmysql-structure/ Share on other sites More sharing options...
taith Posted April 27, 2007 Share Posted April 27, 2007 ya... its prolly faster to make a new table at that number of users... on your login... mysql_query("INSERT ... (id,name,timestamp)..."); then on every page... $timeout=time()+3600; #now +1 hour $query=mysql_query("SELECT `id` FROM ... WHERE `timestamp`<='$timeout' "); while($row=mysql_fetch_assoc($query)){ mysql_query("DELETE FROM ... WHERE `id`='$row[id]' LIMIT 1"); } so you only got people that have been online in the last hour... you can then query to build your lists accordingly :-) Link to comment https://forums.phpfreaks.com/topic/48891-got-advice-on-whos-online-phpmysql-structure/#findComment-239675 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.