title: Error trying to create login system
body: <p>I've been trying to create a login system in PHP.
  I've managed to successfully to connect the database but I'm got a problem saying</p>
  
  <blockquote>
    <p>Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp1\htdocs\login\check.php on line 23<br>
    Wrong username or password are wrong
    Notice: Undefined property: mysqli::$close in C:\xampp1\htdocs\login\check.php on line 36</p>
  </blockquote>
  
  <p>My code is:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Login Page&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;form method="post" action="check.php" &gt;
      &lt;table&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;label&gt;Username&lt;/label&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" name="username"&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;label&gt;password&lt;/label&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" name="password"&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;input type="submit" value="submit"&gt;&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  &lt;?php
  ob_start();
  $username= $_POST['username'];
  $password= $_POST['password'];
  
  $servername= "localhost";
  $username= "root";
  $password = "";
  $dbname="login";
  
  $conn= mysqli_connect($servername,$username,$password,$dbname);
  
  if (!$conn){
      die("Not connected". mysqli_connect_error);
  }else{
      echo "connection sucessful";
  
  }
  
  $sql= "select * from details where $username=username and $password=password";
  
  $result=mysql_query($sql);
  $count=mysql_num_rows($result);
  
  
  
  if ($count == 1){
      header("location:sucess.php");
  }else{
      echo "Wrong username or password are wrong";
  
  
  }
  $conn-&gt;close;
  ob_end_flush();
  </code></pre>