Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从存储过程获取输出参数_Php_Sql Server_Stored Procedures - Fatal编程技术网

Php 从存储过程获取输出参数

Php 从存储过程获取输出参数,php,sql-server,stored-procedures,Php,Sql Server,Stored Procedures,我试图启动存储过程并返回输出参数和结果集。目前,我只得到了一个带有balnk变量的结果集数组,输出参数应该在这个数组中 //initiate function $proc = mssql_init('usp_Web_Return_Installer_Details', $msdb); $enrolledScopes = ''; mssql_bind($proc, '@InstallerID', $_SESSION['user']['Installer_ID'], S

我试图启动存储过程并返回输出参数和结果集。目前,我只得到了一个带有balnk变量的结果集数组,输出参数应该在这个数组中

//initiate function
    $proc = mssql_init('usp_Web_Return_Installer_Details', $msdb); 

    $enrolledScopes = '';

    mssql_bind($proc, '@InstallerID', $_SESSION['user']['Installer_ID'], SQLINT4, false, false, 10);

    mssql_bind($proc, '@EnrolledScopes', &$enrolledScopes, SQLVARCHAR, true, true, 5000); 

    //Execute Procedure 
    $result = mssql_execute($proc); 

    do {
    while ($row = mssql_fetch_assoc($result)){
        $results[] = $row;    
        }
    } while (mssql_next_result($result));

    //Free Memory 
    mssql_free_statement($proc); 

    print_r($result);

您需要为StoredProcess中的输出参数添加
mssql\u bind

mssql_bind($stmt, "@outParam", &$outParam, true)

因此,
$outParam
是您的结果。

这是这行应该做的:mssql_绑定($proc、@EnrolledScopes’,&$EnrolledScopes,SQLVARCHAR,true,true,5000);对。因此,结果应该是
$enrolledScopes
是的,我就是这么说的,$result数组返回预期内容,但$enrolledScopes为空抱歉,我没有从您的代码中看到它:D,可能是问题,我确实看到了,但不知道是否有人知道解决方法。那只虫子也很老了