SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    At My Desk!!
    Posts
    1,642
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Setting a timestamp into DB

    Hey guys im trying to check and see what time a user comes onto my site and then register that time in a the DB and update when they leave to get a total ammount of time spent on my site. I could also store the time in a session and before the session ends forward the total time to the DB. Need some info on what is the best thing to do in this instance and also how to implement it.

    P.s i dont need and code for starting sessions or mysql queries just the time stamp coding.

    Thx, WebNoob
    "Am I the only one doing ASP.NET in Delphi(Pascal)?"

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,253
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)

    timestamp

    I think that as long as you are consistent in using either the MySQL timestamp - OR - the PHP unix timestamp, it would be a simple matter of subtracting the beginning time from the ending time to get the time in seconds.

  3. #3
    SitePoint Wizard holmescreek's Avatar
    Join Date
    Mar 2001
    Location
    Northwest Florida
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Another thing to consider is if the user just closes the browser, without clicking the log out button, your site will still consider the user online.

    You probably knew that...just posted in case you didn't.
    intragenesis, llc professional web & graphic design


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •