特定の日付までに登録された人のvBulletinのユーザーテーブルからすべてのユーザー名のリストを抽出する必要があります。たとえば、10月1日まではすべてのメンバーが必要ですが、それ以降は必須ではありません。
'joindate'フィールドは秒単位で表されると思います。例えば。1116022743.これに基づいてユーザー名を抽出するにはどうすればよいですか?
乾杯
UNIX_TIMESTAMP
MySQL 関数を使用してクエリを作成できます。参加日が 2010 年 10 月 1 日より前である vBulletin インストール内のすべてのユーザーのユーザー名を抽出するクエリを次に示します。
SELECT username FROM user WHERE joindate < UNIX_TIMESTAMP('2010-10-01 00:00:00');
逆のことをしたい場合 (タイムスタンプを UNIX 形式から読み取り可能なものに変換する) を使用できますFROM_UNIXTIME
。
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);
}