title: PHP / MySQLi: Login form isn't working
body: <p>I wrote a PHP code with MySQL for a login form.
  Now I heard it's better to use MySQLi - so I tried to rewrite the code. This is my working MySQL code:</p>
  
  <pre><code>$username = $_POST["username"];
  $password = md5($_POST["password"]);
  
  $query = "SELECT username, password FROM accounts WHERE username LIKE '$username' LIMIT 1";
  $result = mysql_query($query);
  $row = mysql_fetch_object($result);
  
  if($row-&gt;password == $password)
      {
      echo "&lt;h3&gt;Hallo $username&lt;/h3&gt;";
      $_SESSION["username"] = $username;
  
      echo "Login succesfully:";
      }
  else
      {
      echo "Login not succesfully";
      }
  </code></pre>
  
  <p>To use MySQLi I tried to change it to the following: </p>
  
  <pre><code>$username = $_POST["username"];
  $password = md5($_POST["password"]);
  
  $query = "SELECT username, password FROM accounts WHERE username LIKE '$username' LIMIT 1";
  $result = mysqli_query($query);
  $row = mysqli_fetch_object($result);
  
  if($row-&gt;password == $password)
      {
      echo "&lt;h3&gt;Hallo $username&lt;/h3&gt;";
      $_SESSION["username"] = $username;
  
      echo "Login succesfully:";
      }
  else
      {
      echo "Login not succesfully";
      }
  </code></pre>
  
  <p>But unfortunately this does not work.</p>