Hello!

There was a question of this kind, the authorization time is stored in the data_aut line, the last visit time in the date_last line. I need to put in the table how much time the user spent online on the site for all the time. Well, something like: time online 0 days 1 hour 25 minutes 47 seconds.

At first there were some considerations, but as you freaked out, the head doesn’t cook data_aut :) data_aut , date_last are of type int (11) and take the value time (); I also need to put in another table how long the user was online, and add to what was already there, and if it wasn’t, bring the current one with the next update. The row in the table where the total time is stored has the name time with type int (11). At first, I thought to deduct from the time spent on authorization, the time of authorization, but nothing happened ...

I'm still a beginner, so do not judge strictly :) we all learn from mistakes.

  • why not create another cell, under time? - FreeMast
  • Did not quite understand you! Even if it is created, the question still remains open - masa4usec

1 answer 1

I came across a discussion on this topic, let's say, there are a lot of ideas for the implementation of this task, starting from banal cells with relaps, and ending with the creation of a separate table for keeping statistics of attendance, time, even displaying everything on the graph, in your case it seems to me , you can calculate how many people spent time on the site from the entry time, and exit time, check the cell for the presence of data when you first write, if there is no data just write, and if there is, add a new value to what is already in the cell, think nd that something like this.

  • I realized this, the question is how to calculate the time spent on the site, if I and there and there values ​​take time (); for example: $ t = $ user [date_last] - $ user [data_aut]; // from the time of entry we subtract the authorization time and then add this time to the cell in which the total time will be stored on the site. But the question is what function to use so that 00 days 00 hours 00 minutes 00 seconds are displayed. tried date (); But it didn’t happen ... - masa4usec
  • help pliz .... - masa4usec