title: Stored Procedures on PHP and Microsoft SQL Server
body: <p>I'm looking for a solution for my project with PHP and MSSQL (Stored Procedure)..I hope anyone can help me to fix it..Here my PHP code..what I want doing right now for register user function..My stored procedure :sp_register_info</p>
  
  <pre><code>&lt;?php
      session_start();
  
      header('Content-type: text/json');
      header("Cache-Control: no-cache, must-revalidate");
  
      $name = $_REQUEST['data1'];
      $email = $_REQUEST['data2'];
  
  
      MSSQL();
      register_user($name,$email);
  
      function MSSQL(){
          require_once "../myDB.php";
              Connect_MSSQL();
      }
  
      function register_user($name,$email) {
  
              global $DBIn;
  
              $query =    "DECLARE @UserID varchar(20)".
                          "DECLARE @Name varchar(20)".
                          "DECLARE @Email varchar(200)".
                          "SET @Name = $name".
                          "SET @Email  = $email".
                          "EXEC sp_register_info @Name, @Email,@UserID OUTPUT".
                          "select @UserID";
  
              $data = array($name,$email);  
  
              $res =&amp; $DBIn-&gt;query($query,$data);
  
              if ($res-&gt;numRows() &gt; 0) {
  
                      while($row =&amp; $res-&gt;fetchRow(DB_FETCHMODE_ASSOC)){
                              $UserID = $row['UserID'];
                      }
                      loadSuccess(UserID); 
              }
  
              else {
  
                      loadFailed();
              }
  
      }
  
  
      function loadSuccess($UserID) {
  
      header("Content-Type: application/json");
          exit(json_encode(array(
  
                      'UserID'    =&gt; $UserID,
                      'success'       =&gt; 'true',
  
          )));
      }
      function loadFailed(){
  
          exit(json_encode(array(
  
              'success'  =&gt; 'false',
  
          )));
      }       
  ?&gt;
  </code></pre>
  
  <p>This code not work for me..</p>