开发者

Call SQL Server 2008 Stored Procedure from PHP passing in Parameters

开发者 https://www.devze.com 2023-03-07 10:15 出处:网络
I need to call a sql server stored procedure from PHP passing in some parameters. I have the following:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消