Calling a MS SQL stored Procedure From PHP
<p>i have a stored procedure running in MSSQL 2008 R2, i am using PHP 5.3, i can connect successfully to the db and retrieve data, but i have been trying to call a stored procedure and haven't succeeded, i need to pass parameters to the stored procedure then get the results back here is my code but its not executing successfully. anyone please with an example on how i can do this.</p>

<pre><code>&lt;?PHP
  $sql = " { call rpt_TOP_PRODUCTS } ";//my stored procedure
  $param1 = 10;
  $param2 = 'E';
  $param3 = 'SZ';
     $params = Array(Array($param1,$param2,$param3, SQLSRV_PARAM_IN)//parameters to be     passed  );
    $stmt = sqlsrv_query($conn,$sql,$params);

      if ($stmt===false) {
       // handle error
   echo 'Success No';//THIS IS WHERE ITS GOING WHEN I RUN THE CODE
       print_r(sqlsrv_errors,true);
      } else {
         if (sqlsrv_execute($stmt)===false) {
        // handle error.  This is where the error happens
         print_r(sqlsrv_errors,true);
     echo 'Success Not ';
      } else {


  echo 'Success True Yeah';//THIS IS WHERE I WANT IT TO COME.
    }
  }
&lt;?
</code></pre>
