title: Php login page code issue. Login page load message display invalid login
body: <p>Every time at login page load message display invaild login. It is not checking the if condition directly goes to else. I echo my sql query and it is perfectly working fine. But I am not understand where I am making mistake. can you please help me.</p>
  
  <p>my code below,</p>
  
  <pre><code>&lt;?php
      #$error = "";
          $servername = "localhost";
          $username = "";
          $password = "";
          $dbname = "lg_db";
          $tb_name = "lgin";
  
          mysql_connect("$servername", "$username", "$password")or die("Cannot connect");
          mysql_select_db("$dbname")or die("Cannot connect to Database");
  
          $username = $_POST['username'];
          $pass = $_POST['password'];
  $username=stripslashes($username);
  $pass=stripslashes($pass);
  $username=mysql_real_escape_string($username);
  $pass=mysql_real_escape_string($pass);
  
          $sql="SELECT * FROM $tb_name WHERE Name='$username' and Password='$pass'";
  
          $result=mysql_query($sql);
  
          $count1=mysql_num_rows($result);
  
          if($count1 &gt;=1)
          {
              session_start();
             $_SESSION['simple_login'] = $username;
              header("Location: index_new.php");
              exit();
  
          }else{
                   $error="Invalid Login";
          }
  ?&gt;
  </code></pre>