Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
grahamgr3

Chapter 18 Add A Last_Login Field (Solution) Anyone?

Recommended Posts

Can anyone provide me with a simple solution to the Pursue question in chapter 18, create a last_login field and make it so that a user can see how long it has been since they last logged in.

thanks

Graham

Share this post


Link to post
Share on other sites

Assuming you have the last_login field being properly updated in the DB, you can compare that value to the current time.

The following is a good, simple way to calculate the difference between the two:

http://stackoverflow.com/questions/676824/how-to-calculate-the-difference-between-two-dates-using-php

 

(Both Emil H and jurka provide good answers in the SO post above.)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...