"sa","PWD"=>"","Database"=>"test");$conn = sqlsrv_connect( $se">
当前位置:Gxlcms > PHP教程 > php扩展sqlsrv调用mssql存储过程

php扩展sqlsrv调用mssql存储过程

时间:2021-07-01 10:21:17 帮助过:12人阅读

<无详细内容>
  1. $serverName = "127.0.0.1";
  2. $connectionInfo = array( "UID"=>"sa","PWD"=>"","Database"=>"test");
  3. $conn = sqlsrv_connect( $serverName, $connectionInfo);
  4. if( $conn === false )
  5. {
  6. echo "Could not connect.\n";
  7. die( print_r( sqlsrv_errors(), true));
  8. }
  9. $spnumber = '10655****00';
  10. $chargenumber = '155****6789';
  11. //参数需要以如下数组方式赋值并标明类型,SQLSRV_PARAM_IN是输入类型,SQLSRV_PARAM_OUT是输出类型。注意要按照存储过程定义的顺序赋值
  12. $params = array(
  13. array(&$spnumber, SQLSRV_PARAM_IN),
  14. array(&$chargenumber, SQLSRV_PARAM_IN)
  15. );
  16. $tsql_callSP = "{call msgexpress_UnicomNewSubmit(?,?)}";
  17. $stmt3 = sqlsrv_query( $conn, $tsql_callSP, $params);
  18. if( $stmt3 === false )
  19. {
  20. echo "Error in executing statement 3.\n";
  21. die( print_r( sqlsrv_errors(), true));
  22. }

人气教程排行