0

我想在下面的查询中添加另一个检查,所以如果用户在 100 区,它不会允许他转移。数据库中的列是Zone,所以如何正确添加一个检查以查看用户是否在Zone 100不允许他转移。

$num_rows = $db->doQuery('SELECT Class, Race, Strong, Sta, Dex, Intel, Cha, Points, TransferTime FROM USERDATA WHERE strUserId = ? AND (TransferTime < DATEADD(DAY,-2,GETDATE()) OR TransferTime IS NULL)', $character);

if ($num_rows == -1) {
    $db->GetError(__file__, __line__);
    $this->m_ccError = Template::GetLangVar('DB_ERROR');
    return false;
} else if ($num_rows == 0) {
    $this->m_ccError = Template::GetLangVar('RECENT_TRANSFER');
    return false;
}
4

1 回答 1

0

请在下面找到查询:

SELECT Class, Race, Strong, Sta, Dex, Intel, Cha, Points, TransferTime 
FROM USERDATA WHERE strUserId = ? AND 
(TransferTime < DATEADD(DAY,-2,GETDATE()) OR TransferTime IS NULL and Zone<>100

我刚刚在查询中添加了“Zone<>100”以排除 Zone 为 100 的用户。

于 2013-08-19T15:29:07.937 回答