title: sp php send parameters mysqli
body: <p>I want to sp parameter via php mysql I send in.
  This is my code</p>
  
  <pre><code>function sendSpId()
  {
      global $id;
      global $connection;
      $sql = "CALL `sp_st_SelectUserAll`($id)";
      $result = mysqli_query($connection, $sql);
      if ($result === FALSE) {
          die(mysqli_error($connection)); // TODO: better error handling
      }
      //loop the result set
      return mysqli_fetch_array($result);
  
  }
  </code></pre>
  
  <p>This is my connection</p>
  
  <pre><code>&lt;?php
   $serverName = "localhost";
   $userName = "root";
   $pass = "";
   $dbName = "univercity";
  
   $connection = mysqli_connect($serverName, $userName, $pass, $dbName);
   mysqli_set_charset($connection, "utf8");
   if ( !$connection ) {
      die( 'connect error: '.mysqli_connect_error() );
   }
  
  
  ?&gt;
  </code></pre>
  
  <p>And this is my sp</p>
  
  <pre><code>BEGIN
  SELECT * FROM `students` WHERE `id`= id;
  END
  </code></pre>
  
  <p>And the variable $ id is received by session</p>
  
  <pre><code>$id = $_SESSION['id'];
  </code></pre>
  
  <p>But when I run the project I get the following error is</p>
  
  <pre><code>Commands out of sync; you can't run this command now
  </code></pre>
  
  <p>thank you</p>