如何在这个PHP函数中使用GetDate()而不是Time()?

时间:2013-09-27 15:41:05

标签: php sql-server

我如何在下面编辑这个PHP函数,因此它将使用GetDate()并将检查如下:

(nTime < DATEADD(DAY,-7,GETDATE()) OR nTime IS NULL)

而不是

if ((intval ($row['nTime']) + 604800) <= time() || !$count)

基本上我想做同样的事情,但要使用GetDate()代替time()

代码:

$count = $db->doQuery('SELECT * FROM PANEL_NT WHERE strAccountID = ?', $_SESSION['strAccountID']);
$row = $db->doRead();

if ((intval ($row['nTime']) + 604800) <= time() || !$count)
{
    $db->doQuery('SELECT * FROM ACCOUNT_CHAR WHERE strAccountID = ?', $_SESSION['strAccountID']);
    $row = $db->doRead();
    $db->doQuery('EXEC NT ?', $_SESSION['strAccountID']);
    $db->doQuery('DELETE FROM PANEL_NT WHERE strAccountID = ?', $_SESSION['strAccountID']);
    $db->doQuery('INSERT INTO PANEL_NT VALUES (?, ?)', $_SESSION['strAccountID'], time());
    $this->content = Template::Load('error', array('errmsg' => Template::GetLangVar('NATION_TRANSFER_SUCCESS')));
}
else
{
    $this->content = Template::Load('error', 
        array('errmsg' => Template::GetLangVar('NATION_TRANSFER_ERROR'))
        );

0 个答案:

没有答案