How to get the return value of stored procedure of sql server by PDO?

May 2, 2012 at 6:30 AM

I want to show the return value of sp of sql server 2008 on web page by pdo, but i don`t know how to 

do it!   although i tried to use this way, but i wasn`t succeeded :(((

 $sql ="{:returnValue = call [dbo].[DTBL_PreRegister_Insert](:regCode, :opType,...)}";

$preRegResult = $conn->prepare($sql); 

 $returnValue = null;       

$preRegResult->bindParam('returnValue', $returnValue, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT ,15); 

$preRegResult->bindParam('regCode', $preRegisterationCode, PDO::PARAM_STR ); 

  $preRegResult->bindParam('opType', $PreRegisterType, PDO::PARAM_STR );


     if ($returnValue == '0')   {  

        echo 'unsuccessful;  

       }     else     {      

        echo 'successful';   }