- $serverName = "127.0.0.1";
- $connectionInfo = array( "UID"=>"sa","PWD"=>"","Database"=>"test");
- $conn = sqlsrv_connect( $serverName, $connectionInfo);
- if( $conn === false )
- {
- echo "Could not connect.\n";
- die( print_r( sqlsrv_errors(), true));
- }
- $spnumber = '10655****00';
- $chargenumber = '155****6789';
-
- //参数需要以如下数组方式赋值并标明类型,SQLSRV_PARAM_IN是输入类型,SQLSRV_PARAM_OUT是输出类型。注意要按照存储过程定义的顺序赋值
- $params = array(
- array(&$spnumber, SQLSRV_PARAM_IN),
- array(&$chargenumber, SQLSRV_PARAM_IN)
- );
- $tsql_callSP = "{call msgexpress_UnicomNewSubmit(?,?)}";
- $stmt3 = sqlsrv_query( $conn, $tsql_callSP, $params);
- if( $stmt3 === false )
- {
- echo "Error in executing statement 3.\n";
- die( print_r( sqlsrv_errors(), true));
- }
复制代码
|