Avatar of Silencer001
Silencer001
Flag for Belgium

asked on 

Executing stored procedure with IN and OUT parameters in PHP

I want to execute a stored procedure into my PHP code, this stored procedure has an IN and an OUT parameter. The stored procedure is this:
 
USE [phl_pmx]
GO

DECLARE	@return_value int

EXEC	@return_value = [dbo].[PMX_SP_RecreateSynonymsOfSourceDb]
		@sourceDb = phl

SELECT	'Return Value' = @return_value

GO

Open in new window


And I already wrote the following code, but it keeps giving errors that he can't execute it, or he just won't show a thing.

Does anyone know how to correct the code and how I can let PHP show me the output parameter?
 
$link = mssql_connect('server', 'sa', 'pass');

$id = 'phl'
mssql_select_db($id,$link);

$proc = mssql_init("PMX_SP_RecreateSynonymsOfSourceDb");
mssql_bind($proc, "@sourceDb", $id, SQLVARCHAR, FALSE);
mssql_execute($proc);
unset($proc);
mssql_close($link);

Open in new window

PHPMicrosoft SQL Server 2008

Avatar of undefined
Last Comment
Silencer001

8/22/2022 - Mon