title: PHP with Sql with Wammp
body: <p>`
  
  <pre><code>$host="localhost";
  $dbuser="root";
  $pass="";
  $dbname="project";
  $conn=mysqli_connect($host,$dbuser,$pass,$dbname);
  if(mysqli_connect_errno())
  {
      die("Connection Failed! :" . mysqli_connect_error());
  }
  
      if (isset($_POST['submit'])){
  
   $username=$_POST['username'];
      $password=$_POST['password'];       
      //Checking is user existing in the database or not
          $query = "SELECT * FROM login WHERE username='$username' and password='$password'";
          $result = mysqli_query($conn,$query) or die(mysqli_error($conn));
          $rows = mysqli_num_rows($result);
          if($rows&gt;0){
              $_SESSION['username'] = $username;
  
              header("Location: nlogin.php"); // Redirect user to index.php
              }else{
                  ?&gt;
                  &lt;h1 style="color:white"&gt;Username/password is incorrect.&lt;/h1&gt;
                  &lt;?php
                  }
      }
  ?&gt;`
  </code></pre>
  
  <p>Here I have to make it to connect to Login Page and match password in database
      but it always go to else block "Incorrect Password"</p>