This is my php code and whenever i runs it i get that error ...database is on localhost wamp server
<?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);
?>
please suggest the solution for this.