English 中文(简体)
利用时间展示积极的用户?
原标题:Using timestamp to show active users?

我正致力于一种非常简单、内容管理系统。 有一个数据库表,其中载有用户名、密码、电子邮件地址和日期/时间范围,显示用户最后一次登录时间(在更新时使用“NOW”(NOW)。

当用户成功登录时,该书将更新数据库中的表格,并确定新的时间(使用NOW()。)

现在,我要表明,在过去5分钟或10分钟里,哪些用户目前处于gged状态。 我不知道如何做到这一点,因此,我呼吁你们提供帮助。 我在互联网上读到,我需要用一个时间段来做,但我不知道这样做如何。

  1. 我需要知道如何确定一个具体的时间。

  2. I need to know how I can check in PHP if the user has been logged in in the past 5 or 10 minutes so I can display their names somewhere.

感谢你们的帮助!

最佳回答

1. Why do you need to set a custom timestamp? Using NOW() is all you need.

<>2>。 该查询将发现过去10分钟以下所有用户:<代码>最新_login:

www.un.org/spanish/sc/presidency.asp * 用户WHERE最新数据:login >=DATE_SUB(NOW),InterVAL 10 MINUTE

问题回答

......

页: 1

第2段——利用职能时间(现值)获得当前时间(现值单位:美元)

3rd if ( ($now - $date) > ( 5 * 60 /* 5 minute */ ) ) { return "not login" } else return "login"

页: 1





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签