title: Call to a member function query() on resource
body: <p>okay guys so i was just writing the code for an admin panel just for fun, and i ran into a problem when i copied some code from w3schools.
  Can someone tell me where i am wrong.</p>
  
  <p><strong>Here's My Code</strong></p>
  
  <pre><code>    &lt;?php
    $conn = mysql_connect("localhost", "root","","ATFlogin");
  $sql = "SELECT id, username, password FROM users";
  $result = $conn-&gt;query($sql);
  
  if ($result-&gt;num_rows &gt; 0) {
  
      while($row = $result-&gt;fetch_assoc()) {
          echo "&lt;br&gt; id: ". $row["id"]. " - Name: ". $row["firstname"]. " " . $row["lastname"] . "&lt;br&gt;";
      }
  } else {
      echo "0 results";
  }
  ?&gt;
  </code></pre>