I'm trying to figure out how do execute a stored procedure with php5.3/pdo_sqlsrv on sql server 2008.
I've found this code:
$sql = new PDO( "sqlsrv:server=$server;Database = $database", $user, $password);
$query = "{? = CALL sp_Login(?, ?)}";
$stmt = $sql->prepare( $query );
$returnVariable = 0;
$inputVariable1 = 'input1';
$inputVariable2 = 'input2';
$stmt->bindParam(1,$returnVariable,PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT,100);
$stmt->bindParam(2,$inputVariable1,PDO::PARAM_STR);
$stmt->bindParam(3,$inputVariable2,PDO::PARAM_STR);
$stmt->execute();
echo "Return value: ".$returnVariable;
the stored procedure has two input and one output paramter, but it seems it returns nothing, return value is still 0..
I can run select/insert queries, so it's not the connection.
Is there any good documentation about stored procedures with pdo_sqlsrv?
thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…