title: Can't Select username and password Column from user table (MySql)
body: <p>I am putting up an authenticating system on my local server to test run some scripts for my personal use using PHP and MYSQL.  I ran the following code to select the 'username' and 'password' column from a 'users' table, but i kip getting this error after inputting the correct credentials: </p>
  
  <pre><code>Invalid username/password combination
  </code></pre>
  
  <p>Here is the script:</p>
  
  <pre><code>&lt;?php // authentication.php 
  
  require_once 'login.php';
  
  $connection = new mysqli($hn, $un, $pw, $db);
  if ($connection-&gt;connect_error) die($connection-&gt;connect_error);
  
  
  if (isset($_SERVER['PHP_AUTH_USER']) &amp;&amp;
       isset($_SERVER['PHP_AUTH_PW'])) {
  
          $un_temp = mysql_entities_fix_string($connection, $_SERVER['PHP_AUTH_USER']);
          $pw_temp = mysql_entities_fix_string($connection, $_SERVER['PHP_AUTH_PW']);
  
          $query = "SELECT * FROM users WHERE username='$un_temp' AND password='$pw_temp'";
          $result = $connection-&gt;query($query);
          if (!$result) die($connection-&gt;error);
  
      else if ($result-&gt;num_rows) {
  
          $row = $result-&gt;fetch_array(MYSQLI_NUM);
          $result-&gt;close();
  
  
              if ( password_verify( $pw_temp == $row[3]) ) {
  
                  echo "$row[0] $row[1] : Hi $row[0], you are now logged in as '$row[2]'";
  
              }
  
          }
  
              else die("Invalid username/password combination");
  
       } else {
  
              header('WWW-Authenticate: Basic realm="Restricted Section"');
              header('HTTP/1.0 401 Unauthorized');
              die("Pleaser enter your username and password");
       }
  
      $connection-&gt;close();
  
      function mysql_entities_fix_string($connection, $string) {
  
          return htmlentities(mysql_fix_string($connection, $string));
       }
  
      function mysql_fix_string($connection, $string) {
  
          if (get_magic_quotes_gpc()) $string = stripslashes($string);
          return $connection-&gt;real_escape_string($string);
       }
  
  ?&gt;
  </code></pre>