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

时间:2016-11-06 22:58:11

标签: php sqlsrv

我收到此错误

数组([0] =>数组([0] => IMSSP [SQLSTATE] => IMSSP [1] => -14 [代码] => -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.";}
有人请帮帮我......谢谢

1 个答案:

答案 0 :(得分:1)

要对此进行更多调试,您是否可以在查询中代替?对代码进行硬编码,看看它是否有效或是否失败? $params是sqlsrv_query

的可选参数

问题是$conn为空。