我想问一下SELECT Class, Race ......
下面的查询有什么问题。它触发DB_ERROR
$db = $this->database[GDB];
$character = $this->site->SanitizeName($_POST['character']);
$num_rows = $db->doQuery('SELECT bNation FROM ACCOUNT_CHAR WHERE strAccountID = ? AND ? IN(strCharID1, strCharID2, strCharID3)', $_SESSION['strAccountID'], $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('CC_INVALID_ACCOUNT');
return false;
}
$row = $db->doRead();
$nation = $row['bNation'];
$num_rows = $db->doQuery('SELECT Class, Race, Strong, Sta, Dex, Intel, Cha, Points, TransferTime FROM USERDATA u LEFT JOIN PREMIUM_SERVICE p ON p.strAccountID = ? WHERE strUserId = ? AND (TransferTime < IF(p.strAccountID IS NULL, DATEADD(DAY,-2,GETDATE()), DATEADD(MINUTE,-30,GETDATE())) OR TransferTime IS NULL) AND zone<>199 and authority<>255', $_SESSION['strAccountID'], $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('CC_RECENT_TRANSFER');
return false;
}
如果我在下面使用它,效果很好。我添加了高级检查,因此请检查下面不想正常工作的最后一个。
$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) and zone<>199 and authority<>255', $character);
但是如果我在下面使用这个..它会触发$num_rows == -1
并显示DB_ERROR
上面的主要功能。
$num_rows = $db->doQuery('SELECT Class, Race, Strong, Sta, Dex, Intel, Cha, Points, TransferTime FROM USERDATA u LEFT JOIN PREMIUM_SERVICE p ON p.strAccountID = ? WHERE strUserId = ? AND (TransferTime < IF(p.strAccountID IS NULL, DATEADD(DAY,-2,GETDATE()), DATEADD(MINUTE,-30,GETDATE())) OR TransferTime IS NULL) AND zone<>199 and authority<>255', $_SESSION['strAccountID'], $character);
如果重要的话,我会使用 MSSQL Server 2005。我将非常感谢任何回应。