title: How to check if database contains username and password?
body: <p>I have the following code -</p>
  
  <pre><code>&lt;?php
  $con=mysqli_connect("localhost","root","","my_db");
  // Check connection
  if (mysqli_connect_errno())
  {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
  
  mysql_select_db("my_db");
  $myusername=mysql_real_escape_string($_POST['myusername']);
  $mypassword=mysql_real_escape_string($_POST['mypassword']);
  
  echo $myusername . " " . $mypassword; 
  
  $sql="SELECT id FROM EMPLOYEE WHERE username='" . $myusername . "' and password='" . $mypassword . "'";
  
  $result=mysqli_query($con, $sql);
  
  // If result matched $myusername and $mypassword, table row must be 1 row
  
  if (mysql_num_rows($result) &gt; 0) {
    // Register $myusername, $mypassword and redirect to file "login_success.php"
    $_SESSION["username"] = $myusername;
    $_SESSION["password"] = $mypassword;
    header("location:login_success.php");
  } else {
    echo "Wrong Username or Password";
  }
  
  mysqli_close($con);
  ?&gt;
  </code></pre>
  
  <p>The Employee table contains
  1 ADMIN PASS
  as id username and password</p>
  
  <p>If i enter it into the form and hit submit, it opens up this code which is check_login.php
  I have echo'd the username and password to check if its correctly entered.
  And it displays ADMIN PASS on screen. So the username and password is correctly entered that's for sure.</p>
  
  <p>Now the only problem is "checking for username and password" inside the employee table. It doesn't work.</p>
  
  <p>Please help.</p>