title: mysqli_num_rows() expects parameter 1 to be mysqli_result, string given in C:\wamp\www\DbConnect.php on line 12
body: <p>This is my php code and whenever i runs it i get that error ...database is on localhost wamp server</p>
  
  <pre><code>&lt;?php
  $username ="root";
  $password= "";
  $hostname ="localhost";
  $database ="mydata";
  $check="";
  $conn = new mysqli($hostname, $username, $password, $database);
  $i = "SELECT * FROM `patient` WHERE 1";
  $num_rows = mysqli_num_rows($i);
  while($row = mysqli_fetch_array($i))
  {
  $r[]=$row;
  $check=$row["emailid"];
  }
  if($check==NULL)
  {
  $r[$num_rows]="Record is not available";
  print(json_encode($r));
  }
  else
  {
  $r[$num_rows]="success";
  print(json_encode($r));
  }
  //mysql_close($conn);
  ?&gt;
  </code></pre>
  
  <p>please suggest the solution for this.</p>