PHP 更新查询中传递的 SQLSRV 参数无效

PHP SQLSRV invalid parameter passed in update query

我遇到了这个错误

A​​rray ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -14 [code] => -14 [2] => 传递了无效参数到 sqlsrv_query. [message] => 一个无效的参数被传递给 sqlsrv_query. ) )

代码是:

 $sql_query = "UPDATE Subscription SET Status = ? where SubscriptionID = ?";
        $params = array(1, $subscription_id);

        $stmt = sqlsrv_query( $conn, $sql_query, $params);

        if( $stmt === false ) { echo " Error occurred while updating in database. "; 
            die( print_r( sqlsrv_errors(), true));}
        else {echo " Database updated successfully.";}

有人请帮助我...谢谢

要进一步调试它,您能否在查询中用硬编码代替 ? 的值,看看它是否有效或失败? $params 是 sqlsrv_query

的可选参数

问题是 $conn 为空。