title: parameterized queries for usercheck
body: <p>I am new to parameterises queries.please help this in usercheck .I am giving the programe.I want to login to the page using my database by using parameterised queries.please help me.Thanks in advance</p>
  
  <pre><code>&lt;html&gt;
  
  &lt;form name="usercheck" method="post" action="newuser.php"&gt;
      username: &lt;input type="text" name="uname"&gt; &lt;br&gt;&lt;br&gt;
      password:&lt;input type="password" name="pswd"&gt;&lt;br&gt;&lt;br&gt;
      &lt;input type="submit" value="Login"&gt;
  &lt;/form&gt;
  
  &lt;?php
  
  session_start();
  
  if (isset($_post['uname'])) {
  
      $uname = $_post['uname'];
      $pswd = $_post["pswd"];
  
      $con = mysqli_connect("localhost", "root", "happy123$", "cbanktb");
      $query = "select * FROM banktable where username=? and password=?";
      $stmt = mysqli_prepare($con, $query);
      If ($stmt) {
  
          mysqli_stmt_bind_param($stmt, "s", $uname, $pswd);
          mysqli_stmt_bind_result($stmt, $dbusername, $dbpassword);
          mysqli_stmt_execute($stmt);
          mysqli_stmt_fetch($stmt);
  
          #$result=mysqli_query($con,"select * from banktable where acno='$aid'");
  
          #$row = mysqli_fetch_row($result);
  
          #echo $row[0]." ".$row[1]." ".$row[2]." ".$row[3]." ".$row[4];
          #$balance=$row[3];
          echo "You are logged in";
      } else {
          echo "You are not $dbusername";
      }
  }
  
  ?&gt;
  
  &lt;/html&gt;
  </code></pre>