PHP Last log in script
<p>I wanted to know a good and effeicent way to be able to tell how long ago my users last logged in.</p>

<p>On the users profile i want it for say how long ago their last log in was.</p>

<p>Eg:</p>

<p>User 1
Last login: 2 hours ago</p>

<p>User 2
Last login: 3 minutes ago</p>

<p>User 3
Last login: 2 months ago</p>

<hr>

<p>I will keep thier last login information in a MySQL database but want to know how to do the script.</p>

<p>Thanks in advanced.</p>

<p>I just realised that StackFlow uses this feature, so that can help you understand what I want.</p>

<hr>

<pre><code>mysql_query("UPDATE users SET lastactivity = ".time()." WHERE id = ".$userID);
</code></pre>

<p>This is how I will update the DB.</p>
