title: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean means what and how can it be fixed?
body: <p>I am trying to output(show) some values from my database then later get my hands dirty on with it.</p>
  
  <p>I wrote a custom code with mysqli but each time I run the page it gives me error mesage saying :</p>
  
  <blockquote>
    <p>Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result,
    boolean given in C:\xampp\htdocs\christembassy\controlscript.php on
    line 30</p>
  </blockquote>
  
  <p>the line 30 on my code is this : <code>if(mysqli_num_rows($result) &gt; 0)</code></p>
  
  <p>And this is the whole code:</p>
  
  <pre><code>&lt;?php
  //setting connection variables
  $hostname = "localhost";
  $username= "root";
  $password ="";
  $db= "cemembers";
  
  //opening connection go database
  $mysqli_db = mysqli_connect($hostname, $username, $password, $db);
  
  //check connection
  if(mysqli_connect_errno()) {
      printf("Connect Failed: %s\n", mysqli_connect_errno());
      exit();
  }
  
  $sql = "SELECT FristName, LastName, Occupation FROM users"; 
  $result = mysqli_query($mysqli_db, $sql);
  
  if(mysqli_num_rows($result) &gt; 0) {
      // output data of each row
      while($row = mysqli_fetch_assoc($result)) {
          echo  ' Name: $row["FirstName"]. $row["LastName"] ."&lt;br&gt;" Cell: $row["Occupation"]'."&lt;br&gt;";
      }
  } else {
      echo(" 0 Results found");
  }
  
  mysqli_close($mysqli_db);
  ?&gt;
  </code></pre>
  
  <p>Please any help would be much appreciated.</p>