title: Php & MYSQL Login Script - Trying to get property of non-object *** on line 11
body: <p>I´m trying to create a simple login script for my Website (with <em>PHP</em> &amp; <em>Mysql</em>). Created the original script with plain <em>php</em> &amp; <em>mysql</em> commands and everything worked just fine. Now i wanted to exchange the old <em>mysql</em> commands with mysqli commands. Somehow i´m now getting the error "<code>Trying to get property of non-object *** on line 11</code>" when I test my script. Could somebody explain exactly to me what causes that problemn and how to solve it (because I dont really understand the error here)?</p>
  
  <p><strong>Login Script:</strong></p>
  
  <pre><code>&lt;?php
  session_start();
  ?&gt;
  &lt;?php
      include_once "db_connect.php";
      $username = $_POST["username"];
      $password = md5($_POST["password"]);
      $abfrage = "SELECT username, password FROM login WHERE username LIKE '$username' LIMIT 1";
      $ergebnis = mysqli_query($verbindung,$abfrage);
      $row = mysqli_fetch_assoc($ergebnis);
      if ($row-&gt;password === $password) {         &lt;--- Line 11
      $_SESSION["username"] = $username;
      if ($username != "admin") {
              echo "Login erfolgreich. &lt;br&gt; &lt;a href=\"../secure/geheim.php\"&gt;Geschützter Bereich&lt;/a&gt;";
      }
      else {
              echo "Login erfolgreich. &lt;br&gt; &lt;a href=\"../secure/admin.php\"&gt;Geschützter Bereich&lt;/a&gt;";
      }
      }
      else {
      echo "Benutzername und/oder Passwort sind falsch.";
  
      }
  ?&gt;
  </code></pre>