如果用戶在過去一小時內有過活動,我正在努力解決。下面是我的代碼,但它總是返回是,不管是什麼:過去一小時內的活動
$houraway = (int)mktime() + (60 * 60);
$now = mktime();
while($user = mysql_fetch_array($qusers)) {
echo $user['Name']." - ";
$datetime = explode(" ", $user['Custom6']);
$date = $datetime[0];
$date = explode("-", $date);
$time = $datetime[1];
$time = explode(":", $time);
$hr = $time[0];
$min = $time[1];
$sec = $time[2];
$y = $date[0];
$m = $date[1];
$d = $date[2];
$lastloginmk = (int)mktime($hr, $min, $sec, $m, $d, $y);
echo " - ".$lastloginmk;
if($lastloginmk <= $houraway) { echo "yes"; } else { echo "no"; }
echo "<br />";
}
最後一次活動的時間被存儲在數據庫中是這樣的:提前
2009-09-22 13:32:28
謝謝!
瑞安
**第2行不相關。 – Ryan 2009-09-22 03:39:34
爲什麼不「hourago」? – NawaMan 2009-09-22 03:42:40
爲什麼不打印'$ lastloginmk'和'$ houraway'?保持打印變量,直到找出錯誤的位置。 – Fragsworth 2009-09-22 03:44:32