title: PHP login page using MS SQL as database
body: <p>just wanna ask on how can I make a login page where-in the user will input the username and password. I have a simple code here but it does not work:</p>
  
  <pre><code>if(isset($_POST['submit'])){
    $user = $_POST['usr']; 
    $pass = $_POST['pwd'];
  $query = "SELECT * FROM [master].[dbo].[userTbl] WHERE [username] = '$user' AND [password] = '$pass'";
  $result = sqlsrv_query($conn,$query);
  if($user == $pass){
  echo "Success";
  }else{ 
  echo "Invalid username/password";
  </code></pre>
  
  <p>Nevermind the $conn, it is for my database connection which is 100% working.
  Feel free to edit my code or give some inputs, I know something is wrong here in the validation part.</p>