vBulletin - 从用户表中提取用户名

发布于 2024-09-27 21:44:19 字数 153 浏览 3 评论 0原文

我需要从 vBulletin 中的用户表中提取截至特定日期注册的人员的所有用户名列表。例如,我需要 10 月 1 日之前的所有成员,但之后就不需要了。

我认为“joindate”字段以秒为单位表示。例如。 1116022743.如何在此基础上提取用户名?

干杯

I need to extract a list of all usernames from the user table in vBulletin of persons who were registered up to a certain date. So for example, I need all members up until 1st Oct, but after that is not required.

The 'joindate' field is expressed in seconds I think. Eg. 1116022743. How can I can extract usernames on this basis?

cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

葮薆情 2024-10-04 21:44:19

在不知道VB表结构的情况下很难给你一个准确的答案,但是查询会像

$date = strtotime('10/01/2010'); 
/* this is the date you are basing our query on
we make a timestamp of it for comparison */

$sql = "SELECT * FROM `vb_users_table` WHERE `joindate` <= '$date'";

那些“秒”是时间戳顺便说一句(技术上是秒,但正确的术语是时间戳)。

例子:

<?php

$date = strtotime('10/01/2010'); //1st oct 2010
$old = strtotime('3/9/2009'); // 9th mar 2009
$new = strtotime('3/9/2011') // 9th mar 2011

/* substitute $old with $new to see the effect */
if($old<=$date) { 
    echo date('d M Y', $old) . ' is before ' . date('d M Y', $date);
} else {
    echo date('d M Y', $old) . ' is not before ' . date('d M Y', $date);
}

Hard to give you an exact answer without knowing the VB table structure, but the query would be something like

$date = strtotime('10/01/2010'); 
/* this is the date you are basing our query on
we make a timestamp of it for comparison */

$sql = "SELECT * FROM `vb_users_table` WHERE `joindate` <= '$date'";

those "seconds" are timestamps btw (technically seconds, but the correct term is timestamp).

example:

<?php

$date = strtotime('10/01/2010'); //1st oct 2010
$old = strtotime('3/9/2009'); // 9th mar 2009
$new = strtotime('3/9/2011') // 9th mar 2011

/* substitute $old with $new to see the effect */
if($old<=$date) { 
    echo date('d M Y', $old) . ' is before ' . date('d M Y', $date);
} else {
    echo date('d M Y', $old) . ' is not before ' . date('d M Y', $date);
}
最美的太阳 2024-10-04 21:44:19

您可以使用 UNIX_TIMESTAMP MySQL 函数来帮助构建查询。下面的查询将提取 vBulletin 安装中所有用户的用户名,其中他们的加入日期在 2010 年 10 月 1 日之前:

SELECT username FROM user WHERE joindate < UNIX_TIMESTAMP('2010-10-01 00:00:00');

如果您想要执行相反的操作(将时间戳从 UNIX 格式转换为可读的时间戳),您可以使用 <代码>FROM_UNIXTIME。

You can use the UNIX_TIMESTAMP MySQL function to help construct the query. Here's a query that will extract the usernames of all the users in a vBulletin installation where their join date is before the 1st of October 2010:

SELECT username FROM user WHERE joindate < UNIX_TIMESTAMP('2010-10-01 00:00:00');

If you want to do the reverse (convert the timestamps from UNIX form into readable ones) you can use FROM_UNIXTIME.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文