Online or offline function PHP <p>I'm working on a "community". And of course I would like to be able to tell if a user is online or offline. </p> <p>I've created so that when you log in a row in my table UPDATE's to 1 (default is 0) and then they're online. And when they log out they're offline. But if they don't press the Log out button, they will be online until they press that button. </p> <p>So what I would like to create is: </p> <ul> <li>After 5 minutes of inactivity the row in my database should UPDATE to 0. </li> </ul> <p>What I'm looking for is how to do this the easiest way. Should I make an mysql_query which UPDATE's the row to 1 every time a page is loaded. Or is there another way to do it? </p>