Php mssql_行\u受影响返回错误的行数

Php mssql_行\u受影响返回错误的行数,php,mysql,sql,Php,Mysql,Sql,下面的代码是一个PHP脚本,通过单击链接激活用户帐户。 执行更新表的SQL查询。更新是好的,但最后我会显示一条消息,如果激活成功与否。但是mssql_rows_impacted可能返回0,因此即使更新成功,我也收到了错误的消息。我不明白怎么了。提前谢谢 $account = $_GET['account']; $code = $_GET['code']; $account = antiinjection($account); $code = antiinjection($code); con

下面的代码是一个PHP脚本,通过单击链接激活用户帐户。 执行更新表的SQL查询。更新是好的,但最后我会显示一条消息,如果激活成功与否。但是mssql_rows_impacted可能返回0,因此即使更新成功,我也收到了错误的消息。我不明白怎么了。提前谢谢

$account = $_GET['account'];
$code = $_GET['code'];

$account = antiinjection($account);
$code = antiinjection($code);

connectdb($CONFIG['dbdbname'], $CONFIG['dbaddress'], $CONFIG['dbuser'], $CONFIG['dbpass']);
mssql_query (sprintf(UPDATE_PAY_STAT, $account, $code));
mssql_query("COMMIT");
$rowsaffected = mssql_rows_affected();
$message =  "
                <div align=center>The account {$account} has been activated! Have fun!</div>
            ";

if( $rowsaffected != 0 ){
echo "$message";
}
else
{
    $message =  "
                <div align=center>The account {$account} has not been activated due to an error. Please contact the Account Support.</div>
                ";
}

echopage('header', 'Activate');
echo($message);
echopage('footer', '');

因为我无法让mssql受影响的行工作,所以我这样做了。我又添加了1个sql查询,用于检查x帐户名是否有pay_stat='1'。谢谢你的回答

   $link=mssql_query (sprintf(SELECT_COUNT_PS, $account));
$row = mssql_fetch_row($link);

if( $row[0] == '1' ){
$message =  "
                <div align=center>The account {$account} has been activated! Have fun!</div>
            ";
}
else
{
    $message =  "
                <div align=center>The account {$account} has not been activated due to an error. Please contact the Account Support.</div>
                ";
}

尝试执行$rowsaffected=mssql\u rows\u impacted;在提交之前,尝试将db link资源作为参数传递给mssql_rows_,在提交之前受影响,但得到相同的结果。非常感谢。