I want to call MS SQL Stored Procedure from PHP code of .Net is shown in screenshot I want to call same stored procedure in PHP
I didn't do something like this before.
Here is what I have done on Laravel:
public function test(){
$user =DB::select(DB::raw(
"exec export.spGetConnection @Token = :token, ,@ReturnJSON = :json",
[
':token' => '00000000-0000-0000-0000-000000000000',
':json' => @ReturnJSONOUTPUT
])
);
var_dump($user);
}
But getting error
********* THIS CODE IN CORE PHP WORKS FOR ME *****************
$conn = sqlsrv_connect( $serverName, $connectionInfo);
$tsql_callSP = "{call export.spGetConnection( ?, ?)}";
$Token = '00000000-0000-0000-0000-000000000000';
$employeeId = 4;
$ReturnJSON = "";
$params = array(
array($Token, SQLSRV_PARAM_IN),
array(&$ReturnJSON, SQLSRV_PARAM_INOUT)
);
$stmt3 = sqlsrv_query( $conn, $tsql_callSP, $params);
you can execute it in this way
public function test(){
$token = '00000000-0000-0000-0000-000000000000';
$user =DB::select('EXEC export.spGetConnection ?', [$token]);
print_r(json_encode($user));
}
I hope it helps you