title: update user details, sql server 2008 sqlsrv
body: <p>Hello i am having some trouble getting a script to run, i keep getting an error message saying it expects two parameters and i have no idea how to fix it, heres the script:</p>
  
  <pre><code>&lt;?php
  session_start ();
  if(isset($_SESSION['user'])){
  $username = $_SESSION['username'];
  if(isset($_POST['submit'])){
      $oldpassword = $_POST['oldpassword'];
      $newpassword = $_POST['newpassword'];
      $serverName = "server";
      $connectionInfo = array("Database"=&gt;"database","UID"=&gt;"id", "PWD"=&gt;"pass");
      $conn = sqlsrv_connect( $serverName, $connectionInfo);
      if( $conn === false){
          echo "Error in connection.\n";
          die( print_r( sqlsrv_errors(), true));
      }
      $tsql = "SELECT userPass FROM customers WHERE userName='$username'";
      $stmt = sqlsrv_query($conn, $tsql, array(), array( "Scrollable" =&gt; 'static' ));
      if ( !$stmt ){
          die( print_r( sqlsrv_errors(), true));
      }
      $rows = sqlsrv_num_rows($stmt);
      if($rows === false){
          die( print_r( sqlsrv_errors(), true));
      }elseif($rows == 0){
          echo "No rows returned.";
          exit();
      }else{
          $querychange = sqlsrv_query("UPDATE customers SET userPass='$newpassword' WHERE userName='$username'");
          session_destroy();
          die ("Your password has been changed. &lt;a href='index.php'&gt;Return&lt;/a&gt; to the main page and login with your new password.");
      }
  }
  }
  ?&gt;
  </code></pre>
  
  <p>I keep getting this error </p>
  
  <blockquote>
    <p>PHP Warning: sqlsrv_query() expects at least 2 parameters, 1 given in file_name.php on line 27</p>
  </blockquote>
  
  <p>Line 27 is where i update customers. If anyone can spot an error in the script can you let me know, also yes I've not done SQL injection, at this stage I'm simply trying to get it working before I implement that.</p>
  
  <p>Thanks for all the help, it's much appreciated </p>