Call SQL Server 2008 Stored Procedure from PHP passing in Parameters
I need to call a sql server stored procedure from PHP passing in some parameters. I have the following:
$serverName = "DB";
$connectionInfo = array( "UID"=>"***", "PWD"=>"***", "Database"=>"database");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
$tsl = "EXEC GetAccountUser(?, ?)";
However when I pass in an array of params, i开发者_如何学Pythont does not work.
Can someone please help? Example code would be appreciated.
$addProduct = $obj->ExecuteQuery("Begin;DECLARE @ProductCode as varchar (100) ;EXEC CREATEPRODUCT'$pname', '$price', @ProductCode OUTPUT, '$merchantId';select @ProductCode;End;");
$productCode = $addProduct[0][0];
For more explanation, you can visit this site.
精彩评论