我想在下面的查询中添加另一个检查,因此如果用户在区域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;
}
答案 0 :(得分: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
我刚刚在查询中添加了“区域&lt;&gt; 100”,以排除区域为100的用户。