Steve Smith
Steve Smith

Reputation: 752

Getting output parameter from stored procedure

I'm trying to get the stored procedure to fire and return the output parameter as well as the result set. Currently I just get the result set array with a balnk variable where the output parameter should be.

//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);

Upvotes: 1

Views: 2212

Answers (1)

bitoshi.n
bitoshi.n

Reputation: 2318

You need to add mssql_bind for your output parameter from storedprocedure

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

So, $outParam is your result.

Upvotes: 0

Related Questions