title: PHP Login & MySql Query
body: <p>I'm having some trouble with my login feature. I've been searching for hours and I could'nt find any problem. I hope you guys will help me.
  I want to get users' login and check if it exists in my DB. Problem is it keeps returning me  : "Password was probably incorrect!". 
  I tried an "echo ($count)", it doesn't return anything. Same thing for "echo($result)".</p>
  
  <p>I'm pretty lost right, I can't understand why this doesn't work...</p>
  
  <p>PS : I'm french so you might see some french words.  </p>
  
  <p>Here's my login form :</p>
  
  <pre><code>&lt;?php
     session_start();
  ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;  
      &lt;meta charset="utf-8" /&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
      &lt;title&gt;Applications&lt;/title&gt;
      &lt;!--Chargement des feuilles de style--&gt;
      &lt;link rel="stylesheet" type="text/css" href="./css/style.css" /&gt;
      &lt;link rel="stylesheet" type="text/css" href="./css/styleLogin.css" /&gt;
      &lt;script src="./js/login/modernizr.custom.63321.js"&gt;&lt;/script&gt;    
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div class="container"&gt;
  
  
          &lt;header&gt;&lt;/header&gt;
  
          &lt;section class="main"&gt;
              &lt;form class="form-2" id="loginForm" action="./controller/checkLogin.php" method="post"&gt;
                  &lt;h1&gt;&lt;span class="log-in"&gt;Se connecter&lt;/span&gt;&lt;/h1&gt;
                  &lt;p class="float"&gt;
                      &lt;label for="loginLabel"&gt;&lt;i class="icon-user"&gt;&lt;/i&gt;Nom d'utilisateur&lt;/label&gt;
                      &lt;input type="text" name="login" id="login"&gt;
                  &lt;/p&gt;
                  &lt;p class="float"&gt;
                      &lt;label for="passwordLabel"&gt;&lt;i class="icon-lock"&gt;&lt;/i&gt;Mot de passe&lt;/label&gt;
                      &lt;input type="password" name="password" class="showpassword" id="password"&gt;
                  &lt;/p&gt;
                  &lt;p class="clearfix"&gt;    
                      &lt;input type="submit" name="submit" value="Se connecter"&gt;
                      &lt;input type="button" name="submitVisit" value="Accès utilisateur"&gt;
                  &lt;/p&gt;
              &lt;/form&gt;​​
          &lt;/section&gt;
  
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>And here's my checkLogin.php :</p>
  
  <pre><code>&lt;?php
  
  session_start();
  
  try {           
      $bdd = new PDO('mysql:host=localhost;dbname=stage','root','');
    }
    catch (Exception $e){ //en cas d'erreur de connexion, afficher le message           
      die('Erreur : '.$e-&gt;getMessage());
    }
  
  if(isset($_POST['submit'])){
      // username and password sent from form 
      $login = $_POST['login'];
      $pass = $_POST['password'];
  
      $qry = "SELECT login FROM users WHERE login = 'admin'";
      $result = mysql_query($qry);
  
  
      // Mysql_num_row is counting table row
      $count = mysql_num_rows($result);
  
      if($count == 0){
          die("Password was probably incorrect!");
      }
      // If result matched $myusername and $mypassword, table row must be 1 row
      elseif($count == 1){
  
          // Register $myusername, $mypassword and redirect to file "login_success.php"
          $_SESSION['login'] = $login;
          header("location: ./login_success.php");
      }
  
      else {
          echo "Wrong Username or Password";
      }
  }
  
  mysql_close($bdd);
  ?&gt;
  </code></pre>
  
  <hr>
  
  <p>I want to log in with this couple : admin/admin.</p>
  
  <p>Thank you in advance.</p>