I am not able to get the output from Stored Procedure in PHP. My variable $value
does not change. I have set attribute bind to PARAM_INPUT_OUTPUT
. Correct response is int
from the procedure.
SQL code inside the procedure runs correctly. What is wrong?
My environment:
- PHP 7.0.15
- FreeTDS 0.91
- MSSQL 2012 SP1
SQL Procedure:
DECLARE @Aaa int
EXECUTE [sp_insert_org]
@Aaa = @Aaa OUTPUT
SELECT @Aaa
PHP Code:
$value = 'hello';
$sth = $db->prepare($sql);
$sth->bindParam(1, $value, PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT, 4);
$sth->execute();
var_export($value);
Result:
'hello'