I need help running a stored procedure from PHP in SQL Server PHP is running on a UNIX / Linux server. We can not get the output variable to return to PHP. The following PHP code is:
$ conn = mssql_connect ('server', 'user', 'pass'); Mssql_select_db ('db', $ conn); $ Process = mssql_init ('usp_StoredProc', $ conn); $ TmpVar1 = 'value'; $ TmpVar2 = 'value2'; $ OutVar1 = ''; $ OutVar2 = ''; Mssql_bind ($ process, "@ var1", $ tmpVar1, SQLVARAR, false, false); Mssql_bind ($ process, "@ var2", $ tmpVar2, SQLVARAR, false, false); Mssql_bind ($ process, "outVar1", $ outVar1, SQLVARCHAR, true); Mssql_bind ($ process, "exit2", $ outVar2, SQLVARCHAR, true); Mssql_execute ($ process, $ Conn); Print ($ outVar1); Print ($ outVar2);
The stored procedure looks like this:
Go to ANSI_LLS Go to Go Transformation Process [DBO] SET QUOTED_IDENTIFIER [usp_StoredProc] (@ var1) In varchar as different @ outVar1 = row1, @ outVar2 = line 2 from table 1, where column 1 = @ var1 and column2 = 2 (36), @ var2 as varchar (10), @ outward varchar (36) OUTPUT, @ outward2 varchar (36) OUTPUT) @ Var2
Can anyone tell me why $ outVar1 and $ outVar2 are not populated? Thanks for any help! According to
, you have to do (emphasis):
Call
mssql_next_result ()
For each result set back by SP you can handle many results in this way.When
mssql_next_result ()
returns incorrectly, you will gain access to output parameters and return value.
Comments
Post a Comment